This will also cause the browser to add new windows/tabs to the single task it maintains. Please don't do this kind of thing. :}
On Sun, May 29, 2011 at 12:01 AM, Doug <[email protected]> wrote: > On May 26, 5:06 pm, bob <[email protected]> wrote: > > I have an app that opens a web browser, but after awhile I want the > > app to switch from the web browser back to itself. Is there an easy > > way to do this? > > I agree with Justin and Mark, but I don't have any ethical qualms in > sharing a solution that does what you want anyway! :-) > > Below, if the started Dummy class just called finish() when launched, > this will achieve the effect you are looking for, but the browser task > will still be alive and the user could return to it if they want. > > By the way, don't do this unless you really understand what you're > getting into. > > Doug > > > > public class Main extends Activity { > Handler handler; > > @Override > public void onCreate(final Bundle savedInstanceState) { > super.onCreate(savedInstanceState); > setContentView(R.layout.main); > handler = new Handler(); > findViewById(R.id.button).setOnClickListener(new > View.OnClickListener() { > public void onClick(final View v) { > startActivity(new Intent(Intent.ACTION_VIEW, > Uri.parse("http://www.google.com"))); > handler.postDelayed(new Runnable() { > public void run() { > final Intent intent = new Intent(Main.this, > Dummy.class); > > intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); > getApplicationContext().startActivity(intent); > } > }, 10000); > } > }); > } > } > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

