我有一个用来扩展应用程序的类。这是它的代码:
package com.example.myapp
public class MainApplication extends Application {
public ArrayList<Level> remoteLevels = new ArrayList<Level>();
public ArrayList<Level> localLevels = new ArrayList<Level>();
public TCMSQLiteHelper sqliteHelper = new TCMSQLiteHelper(this.getApplicationContext());
@Override
public void onCreate() {
super.onCreate();
this.loadRemoteLevels();
localLevels = sqliteHelper.getAllLevels();
if(localLevels.size()>0){
Log.d("DEBUG","Explore Data Found");
} else {
Log.d("DEBUG","No Explore Data Found");
}
}
}
清单具有以下条目
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/TCMTheme"
android:name="MainApplication">
我收到错误java.lang.RuntimeException: Unable to instantiate application com.example.myapp.MainApplication: java.lang.NullPointerException
我错过了什么?