Android java.lang.RuntimeException: Unable to resume activity -
caused by: java.lang.nullpointerexception @ com.myapp.code.worddescription.onrestart(worddescription.java:685) @ android.app.instrumentation.callactivityonrestart(instrumentation.java:1245) @ android.app.activity.performrestart(activity.java:3892) @ android.app.activity.performresume(activity.java:3911) @ android.app.activitythread.performresumeactivity(activitythread.java:2424) i don't understand why keep getting error on worddescription.onrestart. many complaining of force close issues. clue on how fix this? thanks
i think 1 related ..
public class myarrayadapter extends arrayadapter<string> { private final activity context; private final string[] alisttext; private final string [] meaningtext; public myarrayadapter(activity context, string[] wordtext, string[] meaningtext) { super(context, r.layout.desclist2, wordtext); this.context=context; this.alisttext= wordtext; this.meaningtext=meaningtext; } } // ..... @override public void onrestart(){ super.onrestart(); clickflag = false; clickwordflag = false; myarrayadapter.notifydatasetchanged(); <-- line 685 } handler handler = new handler(){ <-- line 709 @override public void handlemessage(message msg){ progressdialog.dismiss(); if{ .... }else{ myarrayadapter = new myarrayadapter(worddescription.this, wordarray, meaningarray); listview.setadapter(myarrayadapter); } }
change
myarrayadapter.notifydatasetchanged(); to
if(myarrayadapter != null) myarrayadapter.notifydatasetchanged(); i suggest vipul shah told in comment.
Comments
Post a Comment