android - My application is crashing when i'm getting push notification -


i updating fragment sqlite when getting push notification server when on same fragment it's update. when on activity , getting push notification application crashing.

here exception :

03-28 22:18:03.302: e/androidruntime(17631): fatal exception: main 03-28 22:18:03.302: e/androidruntime(17631): process: com.newt.vdsi.driver, pid: 17631 03-28 22:18:03.302: e/androidruntime(17631): java.lang.illegalstateexception: can not perform action after onsaveinstancestate 03-28 22:18:03.302: e/androidruntime(17631):    @ android.support.v4.app.fragmentmanagerimpl.checkstateloss(fragmentmanager.java:1360) 03-28 22:18:03.302: e/androidruntime(17631):    @ android.support.v4.app.fragmentmanagerimpl.enqueueaction(fragmentmanager.java:1378) 03-28 22:18:03.302: e/androidruntime(17631):    @ android.support.v4.app.backstackrecord.commitinternal(backstackrecord.java:595) 03-28 22:18:03.302: e/androidruntime(17631):    @ android.support.v4.app.backstackrecord.commit(backstackrecord.java:574) 03-28 22:18:03.302: e/androidruntime(17631):    @ com.newt.vdsi.driver.home$1.onreceive(home.java:517) 03-28 22:18:03.302: e/androidruntime(17631):    @ android.support.v4.content.localbroadcastmanager.executependingbroadcasts(localbroadcastmanager.java:297) 03-28 22:18:03.302: e/androidruntime(17631):    @ android.support.v4.content.localbroadcastmanager.access$000(localbroadcastmanager.java:46) 03-28 22:18:03.302: e/androidruntime(17631):    @ android.support.v4.content.localbroadcastmanager$1.handlemessage(localbroadcastmanager.java:116) 03-28 22:18:03.302: e/androidruntime(17631):    @ android.os.handler.dispatchmessage(handler.java:102) 03-28 22:18:03.302: e/androidruntime(17631):    @ android.os.looper.loop(looper.java:136) 03-28 22:18:03.302: e/androidruntime(17631):    @ android.app.activitythread.main(activitythread.java:5086) 03-28 22:18:03.302: e/androidruntime(17631):    @ java.lang.reflect.method.invokenative(native method) 03-28 22:18:03.302: e/androidruntime(17631):    @ java.lang.reflect.method.invoke(method.java:515) 03-28 22:18:03.302: e/androidruntime(17631):    @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:785) 03-28 22:18:03.302: e/androidruntime(17631):    @ com.android.internal.os.zygoteinit.main(zygoteinit.java:601) 03-28 22:18:03.302: e/androidruntime(17631):    @ dalvik.system.nativestart.main(native method) 

thank in advance.

this happens when host activity fragment has performed onstop() , commit() called on fragmenttransaction after has happened(that when commit called , host activity hidden).

try using local broadcast custom intent filter when push notification received , use broadcast receiver in fragment update logic.

in case if fragment visible when push notification happens it'll update otherwise let oncreateview() handle logic.


Comments

Popular posts from this blog

angularjs - Showing an empty as first option in select tag -

qt - Change color of QGraphicsView rubber band -

c++ - Visible files in the "Projects" View of the Qt Creator IDE if using the CMake build system -