How To Start An Intent For Result From A Contained Class Of An Activity (startactivityforresult)
This is a follow up to my previous question: How to Start an Intent from a contained class of an Activity Basically, I realized that I need to call startActivityForResult (and not
Solution 1:
Yes. Pass your Activity to the contained class as a parameter.
P.S. Do NOT store the reference to the Activity. Pass it in as you need it.
Solution 2:
Well, looking at your question, you should be able to do this:
Class TestLauncher
{
public TestLauncher (Context c)
{
Intent i = new Intent(MainActivity.this, YourActivity.class)
MainActivity.this.startActivityForResult(i, 1);
}
}
Try that and see if it works.
Post a Comment for "How To Start An Intent For Result From A Contained Class Of An Activity (startactivityforresult)"