Skip to content

Instantly share code, notes, and snippets.

@luoyetx
Last active August 29, 2015 14:07
Show Gist options
  • Save luoyetx/5661cf779822b756b2e0 to your computer and use it in GitHub Desktop.
Save luoyetx/5661cf779822b756b2e0 to your computer and use it in GitHub Desktop.
private void startExplicitActivation() {
Log.i(TAG,"Entered startExplicitActivation()");
// TODO - Create a new intent to launch the ExplicitlyLoadedActivity class
Intent explicitIntent = new Intent(ActivityLoaderActivity.this, ExplicitlyLoadedActivity.class);
// TODO - Start an Activity using that intent and the request code defined above
startActivityForResult(explicitIntent, 0);
}
private void startImplicitActivation() {
Log.i(TAG, "Entered startImplicitActivation()");
// TODO - Create a base intent for viewing a URL
// (HINT: second parameter uses Uri.parse())
String url = "http://www.baidu.com";
Uri uri = Uri.parse(url);
Intent baseIntent = new Intent();
baseIntent.setAction(Intent.ACTION_VIEW);
baseIntent.setData(uri);
// TODO - Create a chooser intent, for choosing which Activity
// will carry out the baseIntent
// (HINT: Use the Intent class' createChooser() method)
Intent chooserIntent = Intent.createChooser(baseIntent, "Choose");
Log.i(TAG,"Chooser Intent Action:" + chooserIntent.getAction());
// TODO - Start the chooser Activity, using the chooser intent
startActivity(chooserIntent);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment