fragment - Android application giving Can not perform this action after onSaveInstanceState Error -
hi developing android application in using actionbar sherlock. application contains 1 main activity inside 3 fragments 3 tabs. first tab showing list view if click on list item opens new detail activity. want when close detail activity want automatically switch on tab.
so code looks
public void onlistitemclick(listview l, view v, int position, long id) { super.onlistitemclick(l, v, position, id); intent intent = new intent(getactivity(), carddetails1.class); startactivityforresult(intent, 7); }
and on activity result doing:
@override @suppresslint("newapi") public void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); if(requestcode == 7) { getactivity().getactionbar().setselectednavigationitem(2); } }
but when click on gives me following error
08-08 10:36:58.149: e/androidruntime(7351): java.lang.runtimeexception: failure delivering result resultinfo{who=null, request=131079, result=0, data=null} activity {com.example.sample/com.ecample.sample.leftandrightactivity}: java.lang.illegalstateexception: can not perform action after onsaveinstancestate 08-08 10:36:58.149: e/androidruntime(7351): @ android.app.activitythread.deliverresults(activitythread.java:3398) 08-08 10:36:58.149: e/androidruntime(7351): @ android.app.activitythread.handlesendresult(activitythread.java:3448) 08-08 10:36:58.149: e/androidruntime(7351): @ android.app.activitythread.access$1100(activitythread.java:139) 08-08 10:36:58.149: e/androidruntime(7351): @ android.app.activitythread$h.handlemessage(activitythread.java:1292) 08-08 10:36:58.149: e/androidruntime(7351): @ android.os.handler.dispatchmessage(handler.java:99) 08-08 10:36:58.149: e/androidruntime(7351): @ android.os.looper.loop(looper.java:156)
any 1 having solution this. need help. thank you.
use: transaction.commitallowingstateloss();
when adding or performing fragmenttransaction
causing exception
.
Comments
Post a Comment