我有从我的数据库返回字符串的方法。我的问题是当我尝试使用isEmpty()
或charAt(0)
我得到 nullPointerException 时。这是日志猫:
05-09 15:56:47.002: E/AndroidRuntime(6914): FATAL EXCEPTION: main
05-09 15:56:47.002: E/AndroidRuntime(6914): java.lang.RuntimeException: Unable to instantiate application android.app.Application: java.lang.NullPointerException
05-09 15:56:47.002: E/AndroidRuntime(6914): at android.app.LoadedApk.makeApplication(LoadedApk.java:504)
05-09 15:56:47.002: E/AndroidRuntime(6914): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4364)
05-09 15:56:47.002: E/AndroidRuntime(6914): at android.app.ActivityThread.access$1300(ActivityThread.java:141)
05-09 15:56:47.002: E/AndroidRuntime(6914): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1294)
public boolean setTheCorrectParameterFields(){
String mine = "";
String spinnerExercise = workOutChoose.getSelectedItem().toString();
DataBaseMain fieldsNum = new DataBaseMain(getApplicationContext());
fieldsNum.open();
mine = fieldsNum.getParameters(spinnerExercise);
fieldsNum.close();
if(mine.isEmpty())
return false;
return true;
}