Android start activity for result
From John Freier
Revision as of 07:56, 7 July 2011 by Jfreier (Talk | contribs) (Created page with 'Start Activity For Result This starts an activity and get a result from it, for example you want to create a custom input form. You start the activity with, startActivityForRes…')
Start Activity For Result
This starts an activity and get a result from it, for example you want to create a custom input form.
You start the activity with, startActivityForResult()
Intent intent = new Intent(); intent.setClass(getApplicationContext(), ItemActivity.class); startActivityForResult(intent, 1);
You finish the next activity with, it will take you back to the last activity that was used to open it.
Intent intent=new Intent(); intent.putExtra("variable", "mom"); setResult(RESULT_OK, intent); finish();