android - Application stops on changing page -


i working in 1 application getting continuous response server when change page or moved other screen application gets stop.i receiving response server not updating in listview.

i have used onresume , onpause method still receiving error.

code;

protected class gettask extends asynctask<void, void, integer> {          @override         protected integer doinbackground(void... params) {             // todo auto-generated method stub             try {                 callreceivemsgapiservice();             } catch (exception e) {             }             return 0;         }          @override         protected void onpostexecute(integer result) {             // todo auto-generated method stub             super.onpostexecute(result);             try {                 if (initiate != 1) {                     mmessagehandle.sendemptymessage(0);                     new gettask().execute();                      }                 } else {                       mlivechatlist.setadapter(adapter);                     adapter.notifydatasetchanged();                     mlivechatlist.requestlayout();                                         alert();                 }             } catch (exception e) {             }          }     } 

error:

05-10 14:14:01.213: e/androidruntime(277): fatal exception: main 05-10 14:14:01.213: e/androidruntime(277): java.lang.illegalstateexception: content of adapter has changed listview did not receive notification. make sure content of adapter not modified background thread, ui thread. [in listview(2131361857, class android.widget.listview) adapter(class com.$chatlistadapter)] 05-10 14:14:01.213: e/androidruntime(277):  @ android.widget.listview.layoutchildren(listview.java:1492) 05-10 14:14:01.213: e/androidruntime(277):  @ android.widget.abslistview.ontouchmodechanged(abslistview.java:1960) 05-10 14:14:01.213: e/androidruntime(277):  @ android.view.viewtreeobserver.dispatchontouchmodechanged(viewtreeobserver.java:591) 05-10 14:14:01.213: e/androidruntime(277):  @ android.view.viewroot.ensuretouchmodelocally(viewroot.java:2021) 05-10 14:14:01.213: e/androidruntime(277):  @ android.view.viewroot.ensuretouchmode(viewroot.java:2005) 05-10 14:14:01.213: e/androidruntime(277):  @ android.view.viewroot.handlemessage(viewroot.java:1774) 05-10 14:14:01.213: e/androidruntime(277):  @ android.os.handler.dispatchmessage(handler.java:99) 05-10 14:14:01.213: e/androidruntime(277):  @ android.os.looper.loop(looper.java:123) 05-10 14:14:01.213: e/androidruntime(277):  @ android.app.activitythread.main(activitythread.java:4627) 05-10 14:14:01.213: e/androidruntime(277):  @ java.lang.reflect.method.invokenative(native method) 05-10 14:14:01.213: e/androidruntime(277):  @ java.lang.reflect.method.invoke(method.java:521) 05-10 14:14:01.213: e/androidruntime(277):  @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:868) 05-10 14:14:01.213: e/androidruntime(277):  @ com.android.internal.os.zygoteinit.main(zygoteinit.java:626) 05-10 14:14:01.213: e/androidruntime(277):  @ dalvik.system.nativestart.main(native method) 

could me out of ..@thanks

call adapter.notifydatasetchanged(); after there change in list notify listview contents of list have changed. surely solve error.

protected class gettask extends asynctask<void, void, integer> { public interface tasklistener { public void updateresult(object result); } private tasklistener listener;         @override         protected integer doinbackground(void... params) {             // todo auto-generated method stub             try {                 callreceivemsgapiservice();             } catch (exception e) {             }             return 0;         }          @override         protected void onpostexecute(integer result) {             // todo auto-generated method stub             super.onpostexecute(result);             try {                 if (initiate != 1) {                     mmessagehandle.sendemptymessage(0);                     new gettask().execute();                      }                 } else {            listener.updateresult(result);                     //mlivechatlist.setadapter(adapter);                     //adapter.notifydatasetchanged();                    // mlivechatlist.requestlayout();                                       //  alert();                 }             } catch (exception e) {             }          }     } 

in activity implement interface tasklistener , in updateresult method code commented.


Comments

Popular posts from this blog

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

c++ - qgraphicsview horizontal scrolling always has a vertical delta -