Note that there are some explanatory texts on larger screens.

plurals
  1. PO"Failure Delivering Result " - onActivityForResult
    text
    copied!<p>I have a <code>LoginActivity</code> (User Logs in). It is basically its own <code>Activity</code> that is themed like a dialog (to appear as if a dialog). It appears over a <code>SherlockFragmentActivity</code>. What I want is: If there is a successful login, there should be two <code>FragmentTransaction</code>'s to update the view. Here is the code:</p> <p>In <code>LoginActivity</code>, if successful login,</p> <pre><code>setResult(1, new Intent()); </code></pre> <p>In <code>SherlockFragmentActivity</code>:</p> <pre><code>@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == 1) { LoggedStatus = PrefActivity.getUserLoggedInStatus(this); FragmentTransaction t = MainFragmentActivity.this.getSupportFragmentManager().beginTransaction(); SherlockListFragment mFrag = new MasterFragment(); t.replace(R.id.menu_frame, mFrag); t.commit(); // Set up Main Screen FragmentTransaction t2 = MainFragmentActivity.this.getSupportFragmentManager().beginTransaction(); SherlockListFragment mainFrag = new FeaturedFragment(); t2.replace(R.id.main_frag, mainFrag); t2.commit(); } } </code></pre> <p>It crashes on the first commit, with this LogCat:</p> <pre><code>E/AndroidRuntime(32072): Caused by: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState E/AndroidRuntime(32072): at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1299) E/AndroidRuntime(32072): at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1310) E/AndroidRuntime(32072): at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:541) E/AndroidRuntime(32072): at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:525) E/AndroidRuntime(32072): at com.kickinglettuce.rate_this.MainFragmentActivity.onActivityResult(MainFragmentActivity.java:243) E/AndroidRuntime(32072): at android.app.Activity.dispatchActivityResult(Activity.java:5293) E/AndroidRuntime(32072): at android.app.ActivityThread.deliverResults(ActivityThread.java:3315) </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload