Copy Code code as follows:
Package Com.gzz.whyinzi;
Import Android.net.Uri;
Import Android.os.Bundle;
Import android.app.Activity;
Import android.content.Intent;
Import Android.util.Log;
Import Android.view.Menu;
Import Android.view.View;
public class Mainactivity extends activity {
private static final String TAG = "Activitydemo";
@Override
protected void OnCreate (Bundle savedinstancestate) {
Super.oncreate (savedinstancestate);
Setcontentview (R.layout.activity_main);
Intent Intent = new Intent ();
Intent.setaction ("Android.intent.action.VIEW");
Uri Content_url = Uri.parse (http://www.jb51.net);
Intent.setdata (Content_url);
StartActivity (Intent);
}
@Override
protected void Onresume () {
Super.onresume ();
Intent Intent = new Intent ();
Intent.setaction ("Android.intent.action.VIEW");
Uri Content_url = Uri.parse ("http://play.jb51.net");
Intent.setdata (Content_url);
StartActivity (Intent);
LOG.E (TAG, "Start onresume~~~");
}
@Override
protected void OnStop () {
Super.onstop ();
This.finish ();
LOG.E (TAG, "Start onstop~~~");
}
}
Onresume () in the absence of a default browser, when there is no default browser pop-up prompts to which browser to open, if the click of the cancellation will appear black background, in order to prevent the black background, onsume () again open the browser.
OnStop () ends the process after selecting the browser.