Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>Is it okay to call the code above? Does it get the activity from th stack, or create a new activity? If no, how can I get the activity from the stack?</p> </blockquote> <p><strong>Ans. If u use this code, another instance of ur 1st activity is created on the stack , And no it is not OK..</strong></p> <hr> <p>ok. here is an answer based on ur example above:</p> <p>I suggest u to use <code>startActivityForResult()</code> to call Activity 2 from Activity 1 </p> <p>here , Activity 2 will behave as sub-Activity...u can setResult and call <code>finish()</code> in 2nd Activity when it succesfully completes its task...</p> <p>but before <code>finish()</code> put a boolean extra like this:</p> <pre><code> i.putExtra("passed2nd", true); </code></pre> <p>this will indicate that the user has gone through this 2nd activity</p> <p>Now, u should override, <code>onActivityResult()</code> in your 1st activity,</p> <p>here u can check the request code and retrieve boolean extra from 2nd activity..</p> <hr> <p><strong>now, the important part:</strong> depending whether the boolean is true or not, u can decide to call 3rd activity using <code>startActivityForResult()</code> with a different requestcode,</p> <p>Also, in ur <code>onActivityResult()</code> , u can again check requestcode and do what u wish when activity 3 ends</p> <p>so now the control will be back to ur 1st activity when 3rd activity ends succesfully</p> <p>Here is an <a href="http://thedevelopersinfo.wordpress.com/2009/11/11/using-subactivities-in-android/" rel="nofollow">example</a> to get u started.</p>
    singulars
    1. This table or related slice is empty.
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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