Reputation: 21893
I have a variable declared in my base base that extends Application.
The variable is static and i am able to set it and access it just fine. However on some devices it is null sometimes.
public class Application extends android.app.Application {
public static ArrayList<String> nextPage;
@Override
public void onCreate() {
super.onCreate();
...
}
}
<application
android:name="Application"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.MyTheme" >
...
I am referencing it like this: Application.nextPage
I am using bug sense and I see there have been 30 errors where this variable is null. It only happens rarely, because the app gets thousands of users per day and this error has only occured 30 times this week.
Is anyone aware of such an issue or what might be causing it?
Problem devices:
SCH-I605 19% 3
SM-N900P 13% 2
ST26i 13% 2
SAMSUNG-SGH-I337 13% 2
SHV-E210S 13% 2
DROID RAZR HD 13% 2
SCH-I200 13% 2
DROID RAZR 7% 1
Problem occurred on the following SDK:
4.1.2 40% 12
4.3 30% 9
4.4.2 10% 3
4.1.1 7% 2
4.2.2 7% 2
4.0.3 4% 1
2.3.6 4% 1
Upvotes: 0
Views: 1252
Reputation: 7108
Where in your app do you initialize nextPage?
I would recommend adding nextPage = new ArrayList<String>();
in onCreate of Application, or simply directly in the field variable.
If you initialize nextPage in an activity, then a possible scenario of null could be:
Not knowing how your app is working, this is a thought example but could be an indication of your problem.
Upvotes: 2