java - String from database gives nullPointerException using isEmpty -


i have method returns string db. problem when im trying use isempty() or charat(0) nullpointerexception. here log cat:

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 instantiate application android.app.application: java.lang.nullpointerexception 05-09 15:56:47.002: e/androidruntime(6914):     @ android.app.loadedapk.makeapplication(loadedapk.java:504) 05-09 15:56:47.002: e/androidruntime(6914):     @ android.app.activitythread.handlebindapplication(activitythread.java:4364) 05-09 15:56:47.002: e/androidruntime(6914):     @ android.app.activitythread.access$1300(activitythread.java:141) 05-09 15:56:47.002: e/androidruntime(6914):     @ 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;             } 

mine null on return fieldsnum.getparameters(spinnerexercise). need check non-null value before trying other things it.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -