1,start web browser
-----------------------------------------------------------------------------
Under the system Intent Daquan android Android 2010-01-06 17:27:34 Read 67 Comments 0 Adjust Font Size:
1. From the google search content Intent intent = new Intent (); intent.setAction (Intent.ACT ION_WEB_SEARCH); intent.putExtra (SearchManager.QUERY, "searchString") startActivity (intent);
2. Browse the Web Uri uri = Uri.parse ( "http://www.google.com"); Intent it = new Intent (Intent.ACT ION_VIEW, uri); startActivity (it);
3. Show map Uri uri = Uri.parse ( "geo: 38.899533, -77.036476"); Intent it = new Intent (Intent.Act ion_VIEW, uri); startActivity (it);
4. Path planning Uri uri = Uri.parse ( "http://maps.google.com/maps?f=d&saddr=startLat% 20startLng & daddr = endLat% 20endLng & hl = en"); Intent it = new Intent (Intent.ACT ION_VIEW, URI); startActivity (it);
http://mapki.com/wiki/Google_Map_Parameters#Location 5. Call Uri uri = Uri.parse ( "tel: xxxxxx"); Intent it = new Intent (Intent.ACT ION_DIAL, uri); startActivity (it);
6. Call texting program Intent it = new Intent (Intent.ACT ION_VIEW); it.putExtra ( "sms_body", "The SMS text"); it.setType ( "vnd.android-dir/mms-sms"); startActivity (it);
7. Send SMS Uri uri = Uri.parse ( "smsto: 0800000123"); Intent it = new Intent (Intent.ACT ION_SENDTO, uri); it.putExtra ( "sms_body", "The SMS text"); startActivity (it); String body = "this is sms demo"; Intent mmsintent = new Intent (Intent.ACT ION_SENDTO, Uri.fromParts ( "smsto", number, null)); mmsintent.putExtra (Messaging.KEY_ACT ION_SENDTO_MESSAGE_BODY, body); mmsintent.putExtra (Messaging.KEY_ACT ION_SENDTO_COMPOSE_MODE, true); mmsintent.putExtra (Messaging.KEY_ACT ION_SENDTO_EXIT_ON_SENT, true); startActivity (mmsintent);
8. Send MMS Uri uri = Uri.parse ( "content: / / media/external/images/media/23"); Intent it = new Intent (Intent.ACT ION_SEND); it.putExtra ( "sms_body", "some text"); it.putExtra (Intent.EXTRA_STREAM, uri); it.setType ( "image / png"); startActivity (it); StringBuilder sb = new StringBuilder (); sb.append ( "file ://"); sb.append (fd.getAbsoluteFile ()); Intent intent = new Intent (Intent.ACT ION_SENDTO, Uri.fromParts ( "mmsto", number, null)); / / Below extra datas are all optional. intent.putExtra (Messaging.KEY_ACT ION_SENDTO_MESSAGE_SUBJECT, subject); intent.putExtra (Messaging.KEY_ACT ION_SENDTO_MESSAGE_BODY, body); intent.putExtra (Messaging.KEY_ACT ION_SENDTO_CONTENT_URI, sb.toString ()); intent.putExtra (Messaging.KEY_ACT ION_SENDTO_COMPOSE_MODE, composeMode); intent.putExtra (Messaging.KEY_ACT ION_SENDTO_EXIT_ON_SENT, exitOnSent); startActivity (intent);
9. Send Email
Intent it = new Intent (Intent.ACT ION_SENDTO, uri); startActivity (it); Intent it = new Intent (Intent.ACT ION_SEND); it.putExtra (Intent.EXTRA_EMAIL, "me@abc.com"); //???? it.putExtra (Intent.EXTRA_TEXT, "The email body text"); it.setType ( "text / plain"); startActivity (Intent.createChooser (it, "Choose Email Client")); Intent it = new Intent (Intent.ACT ION_SEND); String [] tos = ( "me@abc.com"); String [] ccs = ( "you@abc.com"); it.putExtra (Intent.EXTRA_EMAIL, tos); it.putExtra (Intent.EXTRA_CC, ccs); it.putExtra (Intent.EXTRA_TEXT, "The email body text"); it.putExtra (Intent.EXTRA_SUBJECT, "The email subject text"); it.setType ( "message/rfc822"); startActivity (Intent.createChooser (it, "Choose Email Client"));
it.putExtra (Intent.EXTRA_SUBJECT, "The email subject text"); it.putExtra (Intent.EXTRA_STREAM, "file: / / / sdcard/mysong.mp3"); sendIntent.setType ( "audio/mp3"); startActivity (Intent.createChooser (it, "Choose Email Client"));
10. Play Media Intent it = new Intent (Intent.ACT ION_VIEW); Uri uri = Uri.parse ( "file: / / / sdcard/song.mp3"); it.setDataAndType (uri, "audio/mp3"); startActivity (it); Uri uri = Uri.withAppendedPath (MediaStore.Audio.Media.INTERNAL_CONTENT_URI, "1"); Intent it = new Intent (Intent.ACT ION_VIEW, uri); startActivity (it);
11.uninstall apk Uri uri = Uri.fromParts ( "package", strPackageName, null); Intent it = new Intent (Intent.ACT ION_DELETE, uri); startActivity (it);
12.install apk Uri installUri = Uri.fromParts ( "package", "xxx", null); returnIt = new Intent (Intent.ACT ION_PACKAGE_ADDED, installUri); private void sendEmail(String[] address, String subject, String msg) {
Intent send = new Intent(Intent.ACTION_SEND); send.putExtra(Intent.EXTRA_EMAIL, address); send.putExtra(Intent.EXTRA_SUBJECT, subject); send.putExtra(Intent.EXTRA_TEXT, msg); send.setType("text/plain"); startActivity(Intent.createChooser(send, "MySendMail")); } --- Intent msg=new Intent(Intent.ACTION_SEND); msg.putExtra(Intent.EXTRA_EMAIL ,"testto@test.net"); msg.putExtra(Intent.EXTRA_SUBJECT, "Here is the subject for the email"); //this next line adds an attachment, but I'm having some issues with the file location msg.putExtra(Intent.EXTRA_STREAM, Uri.parse ("file://" + Environment.getExternalStorageDirectory() + "test.txt")); msg.putExtra(Intent.EXTRA_BCC, "testbcc@test.net"); msg.putExtra(Intent.EXTRA_CC, "testcc@test.net"); //This next line puts in the body of the message msg.putExtra(Intent.EXTRA_TEXT,"Attached is your file "); msg.setType("text/csv"); //Another type to try //msg.setType("message/rfc822"); startActivity(Intent.createChooser(msg, "Send Email")); |
'Android 개발 > Android SDK' 카테고리의 다른 글
Avoiding Memory Leaks (0) | 2011.04.13 |
---|---|
Start Service at boot (0) | 2011.04.13 |
안드로이드(android) 다이얼로그 종류별 구현 방법 (0) | 2011.04.13 |
logcat에서 한글사용대체하는 방법 (0) | 2011.04.13 |
apk만들기 android package 생성 (0) | 2011.04.13 |