getting exception “IllegalStateException: Can not perform this action after onSaveInstanceState”

I have a Live Android application, and from market i have received following stack trace and i have no idea why its happening as its not happening in application code but its getting caused by some or the other event from the application (assumption) I am not using Fragments, still there is a reference of … Read more

IllegalStateException: Can not perform this action after onSaveInstanceState with ViewPager

I’m getting user reports from my app in the market, delivering the following exception: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState at android.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1109) at android.app.FragmentManagerImpl.popBackStackImmediate(FragmentManager.java:399) at android.app.Activity.onBackPressed(Activity.java:2066) at android.app.Activity.onKeyUp(Activity.java:2044) at android.view.KeyEvent.dispatch(KeyEvent.java:2529) at android.app.Activity.dispatchKeyEvent(Activity.java:2274) at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1803) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1112) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1112) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1112) at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchKeyEvent(PhoneWindow.java:1855) at com.android.internal.policy.impl.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1277) at android.app.Activity.dispatchKeyEvent(Activity.java:2269) at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1803) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1112) at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1112) at … Read more

What is IllegalStateException?

Usually, IllegalStateException is used to indicate that “a method has been invoked at an illegal or inappropriate time.” However, this doesn’t look like a particularly typical use of it. The code you’ve linked to shows that it can be thrown within that code at line 259 – but only after dumping a SQLException to standard output. We can’t tell what’s wrong … Read more

how to fix Cannot call sendRedirect() after the response has been committed?

you have already forwarded the response in catch block: RequestDispatcher dd = request.getRequestDispatcher(“error.jsp”); dd.forward(request, response); so, you can not again call the : response.sendRedirect(“usertaskpage.jsp”); because it is already forwarded (committed). So what you can do is: keep a string to assign where you need to forward the response. String page = “”; try { } … Read more