1. Search content from Google
Intent intent = new Intent();
(Intent.ACTION_WEB_SEARCH);
(,"searchString")
startActivity(intent);
2. Browse the web page
Uri uri = ("");
Intent it = new Intent(Intent.ACTION_VIEW,uri);
startActivity(it);
3. Show the map
Uri uri = ("geo:38.899533,-77.036476");
Intent it = new Intent(Intent.Action_VIEW,uri);
startActivity(it);
4. Path planning
Uri uri = ("/maps?f=dsaddr=startLat%20startLng&daddr=endLat%20endLng&hl=en");
Intent it = new Intent(Intent.ACTION_VIEW,URI);
startActivity(it);
5. Make a phone call
Uri uri = ("tel:xxxxxx");
Intent it = new Intent(Intent.ACTION_DIAL, uri);
startActivity(it);
6. Call the program for sending text messages
Intent it = new Intent(Intent.ACTION_VIEW);
("sms_body", "The SMS text");
("-dir/mms-sms");
startActivity(it);
7. Send SMS
Uri uri = ("smsto:0800000123");
Intent it = new Intent(Intent.ACTION_SENDTO, uri);
("sms_body", "The SMS text");
startActivity(it);
String body="this is sms demo";
Intent mmsintent = new Intent(Intent.ACTION_SENDTO, ("smsto", number, null));
(Messaging.KEY_ACTION_SENDTO_MESSAGE_BODY, body);
(Messaging.KEY_ACTION_SENDTO_COMPOSE_MODE, true);
(Messaging.KEY_ACTION_SENDTO_EXIT_ON_SENT, true);
startActivity(mmsintent);
8. Send MMS
Uri uri = ("content://media/external/images/media/23");
Intent it = new Intent(Intent.ACTION_SEND);
("sms_body", "some text");
(Intent.EXTRA_STREAM, uri);
("image/png");
startActivity(it);
StringBuilder sb = new StringBuilder();
("file://");
(());
Intent intent = new Intent(Intent.ACTION_SENDTO, ("mmsto", number, null));
// Below extra datas are all optional.
(Messaging.KEY_ACTION_SENDTO_MESSAGE_SUBJECT, subject);
(Messaging.KEY_ACTION_SENDTO_MESSAGE_BODY, body);
(Messaging.KEY_ACTION_SENDTO_CONTENT_URI, ());
(Messaging.KEY_ACTION_SENDTO_COMPOSE_MODE, composeMode);
(Messaging.KEY_ACTION_SENDTO_EXIT_ON_SENT, exitOnSent);
startActivity(intent);
9. Send Email
Uri uri = ("mailto:xxx@");
Intent it = new Intent(Intent.ACTION_SENDTO, uri);
startActivity(it);
Intent it = new Intent(Intent.ACTION_SEND);
(Intent.EXTRA_EMAIL, "me@");
(Intent.EXTRA_TEXT, "The email body text");
("text/plain");
startActivity((it, "Choose Email Client"));
Intent it=new Intent(Intent.ACTION_SEND);
String[] tos={"me@"};
String[] ccs={"you@"};
(Intent.EXTRA_EMAIL, tos);
(Intent.EXTRA_CC, ccs);
(Intent.EXTRA_TEXT, "The email body text");
(Intent.EXTRA_SUBJECT, "The email subject text");
("message/rfc822");
startActivity((it, "Choose Email Client"));
Intent it = new Intent(Intent.ACTION_SEND);
(Intent.EXTRA_SUBJECT, "The email subject text");
(Intent.EXTRA_STREAM, "file:///sdcard/mysong.mp3");
("audio/mp3");
startActivity((it, "Choose Email Client"));
10. Play multimedia
Intent it = new Intent(Intent.ACTION_VIEW);
Uri uri = ("file:///sdcard/song.mp3");
(uri, "audio/mp3");
startActivity(it);
Uri uri = (.INTERNAL_CONTENT_URI, "1");
Intent it = new Intent(Intent.ACTION_VIEW, uri);
startActivity(it);
apk
Uri uri = ("package", strPackageName, null);
Intent it = new Intent(Intent.ACTION_DELETE, uri);
startActivity(it);
apk
Uri installUri = ("package", "xxx", null);
returnIt = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri);
13. Turn on the camera
<1>Intent i = new Intent(Intent.ACTION_CAMERA_BUTTON, null);
(i);
<2>long dateTaken = ();
String name = createName(dateTaken) + ".jpg";
fileName = folder + name;
ContentValues values = new ContentValues();
(, fileName);
("_data", fileName);
(.PICASA_ID, fileName);
(.DISPLAY_NAME, fileName);
(, fileName);
(.BUCKET_DISPLAY_NAME, fileName);
Uri photoUri = getContentResolver().insert(
.EXTERNAL_CONTENT_URI, values);
Intent inttPhoto = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
(MediaStore.EXTRA_OUTPUT, photoUri);
startActivityForResult(inttPhoto, 10);
14. Select pictures from gallery
Intent i = new Intent();
("image/*");
(Intent.ACTION_GET_CONTENT);
startActivityForResult(i, 11);
15. Turn on the recorder
Intent mi = new Intent(Media.RECORD_SOUND_ACTION);
startActivity(mi);
16. Display the detailed application list
Uri uri = ("market://details?id=app_id");
Intent it = new Intent(Intent.ACTION_VIEW, uri);
startActivity(it);
//where app_id is the application ID, find the ID
//by clicking on your application on Market home
//page, and notice the ID from the address bar
I just found the app id but failed, but I found that using package name is also OK.
Uri uri = ("market://details?id=<packagename>");
This is much simpler
17 Looking for Applications
Uri uri = ("market://search?q=pname:pkg_name");
Intent it = new Intent(Intent.ACTION_VIEW, uri);
startActivity(it);
//where pkg_name is the full package path for an application
18Open the contact list
<1>
Intent i = new Intent();
(Intent.ACTION_GET_CONTENT);
("/phone");
startActivityForResult(i, REQUEST_TEXT);
<2>
Uri uri = ("content://contacts/people");
Intent it = new Intent(Intent.ACTION_PICK, uri);
startActivityForResult(it, REQUEST_TEXT);
19 Open another program
Intent i = new Intent();
ComponentName cn = new ComponentName(".android2",
".");
(cn);
("");
startActivityForResult(i, RESULT_OK);
Intent intent = new Intent();
(Intent.ACTION_WEB_SEARCH);
(,"searchString")
startActivity(intent);
2. Browse the web page
Uri uri = ("");
Intent it = new Intent(Intent.ACTION_VIEW,uri);
startActivity(it);
3. Show the map
Uri uri = ("geo:38.899533,-77.036476");
Intent it = new Intent(Intent.Action_VIEW,uri);
startActivity(it);
4. Path planning
Uri uri = ("/maps?f=dsaddr=startLat%20startLng&daddr=endLat%20endLng&hl=en");
Intent it = new Intent(Intent.ACTION_VIEW,URI);
startActivity(it);
5. Make a phone call
Uri uri = ("tel:xxxxxx");
Intent it = new Intent(Intent.ACTION_DIAL, uri);
startActivity(it);
6. Call the program for sending text messages
Intent it = new Intent(Intent.ACTION_VIEW);
("sms_body", "The SMS text");
("-dir/mms-sms");
startActivity(it);
7. Send SMS
Uri uri = ("smsto:0800000123");
Intent it = new Intent(Intent.ACTION_SENDTO, uri);
("sms_body", "The SMS text");
startActivity(it);
String body="this is sms demo";
Intent mmsintent = new Intent(Intent.ACTION_SENDTO, ("smsto", number, null));
(Messaging.KEY_ACTION_SENDTO_MESSAGE_BODY, body);
(Messaging.KEY_ACTION_SENDTO_COMPOSE_MODE, true);
(Messaging.KEY_ACTION_SENDTO_EXIT_ON_SENT, true);
startActivity(mmsintent);
8. Send MMS
Uri uri = ("content://media/external/images/media/23");
Intent it = new Intent(Intent.ACTION_SEND);
("sms_body", "some text");
(Intent.EXTRA_STREAM, uri);
("image/png");
startActivity(it);
StringBuilder sb = new StringBuilder();
("file://");
(());
Intent intent = new Intent(Intent.ACTION_SENDTO, ("mmsto", number, null));
// Below extra datas are all optional.
(Messaging.KEY_ACTION_SENDTO_MESSAGE_SUBJECT, subject);
(Messaging.KEY_ACTION_SENDTO_MESSAGE_BODY, body);
(Messaging.KEY_ACTION_SENDTO_CONTENT_URI, ());
(Messaging.KEY_ACTION_SENDTO_COMPOSE_MODE, composeMode);
(Messaging.KEY_ACTION_SENDTO_EXIT_ON_SENT, exitOnSent);
startActivity(intent);
9. Send Email
Uri uri = ("mailto:xxx@");
Intent it = new Intent(Intent.ACTION_SENDTO, uri);
startActivity(it);
Intent it = new Intent(Intent.ACTION_SEND);
(Intent.EXTRA_EMAIL, "me@");
(Intent.EXTRA_TEXT, "The email body text");
("text/plain");
startActivity((it, "Choose Email Client"));
Intent it=new Intent(Intent.ACTION_SEND);
String[] tos={"me@"};
String[] ccs={"you@"};
(Intent.EXTRA_EMAIL, tos);
(Intent.EXTRA_CC, ccs);
(Intent.EXTRA_TEXT, "The email body text");
(Intent.EXTRA_SUBJECT, "The email subject text");
("message/rfc822");
startActivity((it, "Choose Email Client"));
Intent it = new Intent(Intent.ACTION_SEND);
(Intent.EXTRA_SUBJECT, "The email subject text");
(Intent.EXTRA_STREAM, "file:///sdcard/mysong.mp3");
("audio/mp3");
startActivity((it, "Choose Email Client"));
10. Play multimedia
Intent it = new Intent(Intent.ACTION_VIEW);
Uri uri = ("file:///sdcard/song.mp3");
(uri, "audio/mp3");
startActivity(it);
Uri uri = (.INTERNAL_CONTENT_URI, "1");
Intent it = new Intent(Intent.ACTION_VIEW, uri);
startActivity(it);
apk
Uri uri = ("package", strPackageName, null);
Intent it = new Intent(Intent.ACTION_DELETE, uri);
startActivity(it);
apk
Uri installUri = ("package", "xxx", null);
returnIt = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri);
13. Turn on the camera
<1>Intent i = new Intent(Intent.ACTION_CAMERA_BUTTON, null);
(i);
<2>long dateTaken = ();
String name = createName(dateTaken) + ".jpg";
fileName = folder + name;
ContentValues values = new ContentValues();
(, fileName);
("_data", fileName);
(.PICASA_ID, fileName);
(.DISPLAY_NAME, fileName);
(, fileName);
(.BUCKET_DISPLAY_NAME, fileName);
Uri photoUri = getContentResolver().insert(
.EXTERNAL_CONTENT_URI, values);
Intent inttPhoto = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
(MediaStore.EXTRA_OUTPUT, photoUri);
startActivityForResult(inttPhoto, 10);
14. Select pictures from gallery
Intent i = new Intent();
("image/*");
(Intent.ACTION_GET_CONTENT);
startActivityForResult(i, 11);
15. Turn on the recorder
Intent mi = new Intent(Media.RECORD_SOUND_ACTION);
startActivity(mi);
16. Display the detailed application list
Uri uri = ("market://details?id=app_id");
Intent it = new Intent(Intent.ACTION_VIEW, uri);
startActivity(it);
//where app_id is the application ID, find the ID
//by clicking on your application on Market home
//page, and notice the ID from the address bar
I just found the app id but failed, but I found that using package name is also OK.
Uri uri = ("market://details?id=<packagename>");
This is much simpler
17 Looking for Applications
Uri uri = ("market://search?q=pname:pkg_name");
Intent it = new Intent(Intent.ACTION_VIEW, uri);
startActivity(it);
//where pkg_name is the full package path for an application
18Open the contact list
<1>
Intent i = new Intent();
(Intent.ACTION_GET_CONTENT);
("/phone");
startActivityForResult(i, REQUEST_TEXT);
<2>
Uri uri = ("content://contacts/people");
Intent it = new Intent(Intent.ACTION_PICK, uri);
startActivityForResult(it, REQUEST_TEXT);
19 Open another program
Intent i = new Intent();
ComponentName cn = new ComponentName(".android2",
".");
(cn);
("");
startActivityForResult(i, RESULT_OK);