Sunday, October 3, 2010

[android-developers] dual activity

Once user selects yes in dialog I start activity to open url in droid
browser:

public void onClick(DialogInterface dialog, int whichButton) {
String url =
SubmitActivity.this.getString(R.string.SubmitActivity_report_url);
Intent i = new Intent(Intent.ACTION_VIEW,Uri.parse(url));
startActivity(i);
startActivityForResult(i, 1);
// return to first page
// ...
}

I realized that after the user does what ever they need to in browser
they are clicking back button and ending up on the last page in my
android app instead of first page. So thought of doing this by using
startActivityForResult catching result and starting another activity:

somewhere in onActivityResult {

else if (resultCode == RESULT_CANCELED && requestCode == 1) {
Intent j = new Intent(SubmitActivity.this,
MainAppPanelActivity.class);
startActivity(j);
finish();
}

}

Seems this activity does not work the way I expect. My question, is
there any way to start two activities that would complete independent,
one that opens browser, and one that completes move to first page. If
I have to create a new thread that is fine, just thought there maybe
easier solution.

Thanks all.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment