Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You need to use bundle and pass appropriate parameter/or parameters from the calling app (i.e. click something in the app (TextView with a link)).</p> <p>Retrieve the parameter in the called app (Email app).</p> <p>You can send the name of the activity in the parameter.</p> <p>Now being in Email app(the called app) Click of back button navigate back to your calling application.</p> <p>Optionally you can save the state of activity from the caller program, as required.</p> <p>You need to use Bundle, and Intent to implement this logic.</p> <p>Code snippet:</p> <p>In the calling program, we need to store parameters/data required for back button functionality in the called program.</p> <p>Bundle bndleData = new Bundle(); Use putString(), putInt() methods of Bundle class.</p> <pre><code> String prefix = getPackageName().toString(); (this prefix can be stored in application level constants.java file as applicable) bndleData.putString("ParentActivity", this.getLocalClassName()); </code></pre> <p>Also store additional parameters if required bndleData.putString("paramName", valueofParamName); bndleData.putInt("IntChannelImage", chImageInt);</p> <pre><code> Intent intent = new Intent(v.getContext(), AMRChannelPlayer.class); intent.putExtra(prefix + "bndleChnlData", bndleData); startActivity(intent); </code></pre> <p>Caller Program: Retrive the data, activity nae from bundle and use it in back button implementation:</p> <p>prefix = getPackageName().toString(); Bundle extras = getIntent().getBundleExtra(prefix + "bndleData");</p> <p>String parentActivity = extras.getString("ParentActivity"); extras.getString("paramName");</p> <p>I hope this helps you.</p>
 

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