Note that there are some explanatory texts on larger screens.

plurals
  1. POstartActivityForResult starts a second activity which exits the app
    primarykey
    data
    text
    <h2>Scenario</h2> <p>Activity A (login) starts activity B then finish();</p> <p>Activity B calls startActivityForResult(Activity C)</p> <p>Activity C runs nicely, then exits after choosing a phone number (as it should)</p> <p>-- Back to the desktop (app stops)!</p> <p>Why didn't it get back to Activity B's onActivityResult()?</p> <h2>Notes</h2> <p>I have created the proper onActivityResult() on activity B.</p> <p>I have searched and read every shred of data on stackoverflow about startActivityForResult.</p> <h2>Code Slips</h2> <p>The code which starts Activity B:</p> <pre><code>ComponentName component = new ComponentName("com.emobiletelecom", PokeTALK.class.getName()); Intent intent = new Intent(); intent.setComponent(component); startActivity(intent); finish(); </code></pre> <p>The code which starts Activity C:</p> <pre><code>startActivityForResult(new Intent(this, ContactsPickerActivity.class), 2007); </code></pre> <p>The code finishing Activity C:</p> <pre><code>Intent intent = new Intent(); intent.putExtra(KEY_PHONE_NUMBER, contactNumber); setResult(RESULT_OK, intent); finish(); enter code here </code></pre> <h2>LOG</h2> <pre><code>04-23 16:32:27.382: I/ActivityManager(28158): START {cmp=com.emobiletelecom/com.codinguser.android.contactpicker.ContactsPickerActivity} from pid 30108 04-23 16:32:27.392: W/WindowManager(28158): Failure taking screenshot for (180x300) to layer 21010 04-23 16:32:27.432: V/PokeTALK(30108): onPause 04-23 16:32:27.642: I/WindowManager(28158): createSurface Window{415eefe8 com.emobiletelecom/com.codinguser.android.contactpicker.ContactsPickerActivity paused=false}: DRAW NOW PENDING 04-23 16:32:27.812: V/PhoneStatusBar(28212): setLightsOn(true) 04-23 16:32:28.042: I/ActivityManager(28158): Displayed com.emobiletelecom/com.codinguser.android.contactpicker.ContactsPickerActivity: +599ms 04-23 16:32:28.192: V/PT(30108): onStop - PokeTALK 04-23 16:33:00.292: D/dalvikvm(28212): GC_CONCURRENT freed 396K, 36% free 10580K/16391K, paused 14ms+8ms 04-23 16:33:24.102: D/dalvikvm(30108): GC_FOR_ALLOC freed 189K, 6% free 12032K/12679K, paused 52ms 04-23 16:33:24.122: I/dalvikvm-heap(30108): Grow heap (frag case) to 13.159MB for 1390096-byte allocation 04-23 16:33:24.232: D/dalvikvm(30108): GC_CONCURRENT freed 33K, 6% free 13355K/14087K, paused 4ms+4ms 04-23 16:33:24.341: D/dalvikvm(30108): GC_FOR_ALLOC freed 0K, 6% free 13356K/14087K, paused 34ms 04-23 16:33:24.351: I/dalvikvm-heap(30108): Grow heap (frag case) to 14.452MB for 1390096-byte allocation 04-23 16:33:24.522: D/dalvikvm(30108): GC_CONCURRENT freed &lt;1K, 6% free 14713K/15495K, paused 18ms+5ms 04-23 16:33:27.342: W/WindowManager(28158): Failure taking screenshot for (180x300) to layer 21015 04-23 16:33:27.392: W/NetworkManagementSocketTagger(28158): setKernelCountSet(10005, 1) failed with errno -2 04-23 16:33:27.442: I/WindowManager(28158): createSurface Window{41614cd0 com.android.launcher/com.android.launcher2.Launcher paused=false}: DRAW NOW PENDING 04-23 16:33:27.532: W/InputManagerService(28158): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@413fbdb0 (uid=10040 pid=30108) 04-23 16:33:28.292: W/NetworkManagementSocketTagger(28158): setKernelCountSet(10040, 0) failed with errno -2 </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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