android - Why do my objects become null on returning to my previous Activity -
i have 2 activities suppose , b;
activity a has several objects of view [textview
, tabview
, listview
etc]:
i fire intent using startactivityforresult
, go activity b
then computation required in activity b , return activity a setruslt
, finish();
on returning onactivityresult work according result sent activity b;
everything above works fine.[during testing]
but when have deployed application facing crashes [unexpected nullpointer exception]
-> in cases listview inside onresume method null;
-> in cases tabview null;
-> in cases database object instance null;
am missing important step of activity lifecycle. works fine while in testing.
please note: have map views on both activities
please help. thank in advance.
here's stack trace
java.lang.nullpointerexception @ in.abmulani.thisway.mainactivity.onkeydown(mainactivity.java:511) @ android.view.keyevent.dispatch(keyevent.java:2719) @ android.app.activity.dispatchkeyevent(activity.java:2419) @ com.android.internal.policy.impl.phonewindow$decorview.dispatchkeyevent(phonewindow.java:190) @ android.view.viewrootimpl.deliverkeyeventpostime(viewrootimpl.java:4150) @ android.view.viewrootimpl.handleimefinishedevent(viewrootimpl.java:4112) @ android.view.viewrootimpl$viewroothandler.handlemessage(viewrootimpl.java:3292) @ android.os.handler.dispatchmessage(handler.java:99)
sometimes data in onactivityresult null.have checked it?
and if activity has launchmode of singleinstance,the onactivityresult invoked android staractivityforresult.make sure activity not singleinstance activity.
last, have done in onresume method?
Comments
Post a Comment