On May 26, 5:06 pm, bob <b...@coolgroups.com> 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to