Android Intent and intent action Daquan

Source: Internet
Author: User

Intent is often used in Android. Whether it is the page pull, or pass data, or call external programs, the system functions are used to intent. After doing some examples of intent, finishing a bit of intent, hope to be useful to everyone. Because intent content too much, can not really write full, inevitably will have left behind, I will be updated at any time. If you have questions or new intent content, want to communicate.

★intent Daquan:
1. Search content from Google
Intent Intent = new Intent ();
Intent.setaction (Intent.action_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.action_view,uri);
StartActivity (IT);

3. Show Map
Uri uri = uri.parse ("geo:38.899533,-77.036476");
Intent it = new Intent (Intent.action_view,uri);
StartActivity (IT);

4. Path planning
Uri uri = Uri.parse ("http://maps.google.com/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 = uri.parse ("tel:xxxxxx");
Intent it = new Intent (intent.action_dial, URI);
StartActivity (IT);

6. Call the program to send SMS
Intent it = new Intent (Intent.action_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.action_sendto, URI);
It.putextra ("Sms_body", "The SMS Text");
StartActivity (IT);
String body= "This is SMS Demo";
Intent mmsintent = new Intent (intent.action_sendto, Uri.fromparts ("Smsto", number, null));
Mmsintent.putextra (Messaging.key_action_sendto_message_body, BODY);
Mmsintent.putextra (Messaging.key_action_sendto_compose_mode, true);
Mmsintent.putextra (Messaging.key_action_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.action_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.action_sendto, Uri.fromparts ("Mmsto", number, null));
Below Extra datas is all optional.
Intent.putextra (Messaging.key_action_sendto_message_subject, SUBJECT);
Intent.putextra (Messaging.key_action_sendto_message_body, BODY);
Intent.putextra (Messaging.key_action_sendto_content_uri, sb.tostring ());
Intent.putextra (Messaging.key_action_sendto_compose_mode, Composemode);
Intent.putextra (Messaging.key_action_sendto_exit_on_sent, exitonsent);
StartActivity (Intent);

9. Send Email
Uri uri = uri.parse ("Mailto:[email protected]");
Intent it = new Intent (intent.action_sendto, URI);
StartActivity (IT);
Intent it = new Intent (intent.action_send);
It.putextra (Intent.extra_email, "[EMAIL protected]");
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.action_send);
String[] tos={"[Email protected]"};
String[] ccs={"[Email protected]"};
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"));

Intent it = new Intent (intent.action_send);
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 Multimedia
Intent it = new Intent (Intent.action_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.action_view, URI);
StartActivity (IT);

11.uninstall apk
Uri uri = uri.fromparts ("package", strpackagename, NULL);
Intent it = new Intent (Intent.action_delete, URI);
StartActivity (IT);

12.install apk
Uri Installuri = uri.fromparts ("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);
This.sendbroadcast (i);
<2>long Datetaken = System.currenttimemillis ();
String name = Createname (Datetaken) + ". jpg";
FileName = folder + name;
Contentvalues values = new Contentvalues ();
Values.put (Images.Media.TITLE, fileName);
Values.put ("_data", fileName);
Values.put (Images.Media.PICASA_ID, fileName);
Values.put (Images.Media.DISPLAY_NAME, fileName);
Values.put (Images.Media.DESCRIPTION, fileName);
Values.put (Images.ImageColumns.BUCKET_DISPLAY_NAME, fileName);
Uri Photouri = Getcontentresolver (). Insert (
MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);

Intent Inttphoto = new Intent (mediastore.action_image_capture);
Inttphoto.putextra (Mediastore.extra_output, Photouri);
Startactivityforresult (Inttphoto, 10);

14. Select a picture from gallery
Intent i = new Intent ();
I.settype ("image/*");
I.setaction (intent.action_get_content);
Startactivityforresult (i, 11);

15. Turn on the recorder
Intent mi = new Intent (media.record_sound_action);
StartActivity (MI);

16. Show App Detail List
Uri uri = uri.parse ("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 in market home
page, and notice the ID from the address bar

Just looking for the app ID has not been found, the result finds the package name can also
Uri uri = uri.parse ("market://details?id=<packagename>");
That's a lot easier.

17 Finding applications
Uri uri = uri.parse ("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

18 Open a contact list
<1>
Intent i = new Intent ();
I.setaction (intent.action_get_content);
I.settype ("Vnd.android.cursor.item/phone");
Startactivityforresult (i, request_text);

<2>
Uri uri = uri.parse ("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 ("Com.yellowbook.android2",
"Com.yellowbook.android2.AndroidSearch");
I.setcomponent (CN);
I.setaction ("Android.intent.action.MAIN");
Startactivityforresult (i, RESULT_OK);

★intent Action Daquan:
  • Android.intent.action.ALL_APPS
  • Android.intent.action.ANSWER
  • Android.intent.action.ATTACH_DATA
  • Android.intent.action.BUG_REPORT
  • Android.intent.action.CALL
  • Android.intent.action.CALL_BUTTON
  • Android.intent.action.CHOOSER
  • Android.intent.action.CREATE_LIVE_FOLDER
  • Android.intent.action.CREATE_SHORTCUT
  • Android.intent.action.DELETE
  • Android.intent.action.DIAL
  • Android.intent.action.EDIT
  • Android.intent.action.GET_CONTENT
  • Android.intent.action.INSERT
  • Android.intent.action.INSERT_OR_EDIT
  • Android.intent.action.MAIN
  • Android.intent.action.MEDIA_SEARCH
  • Android.intent.action.PICK
  • Android.intent.action.PICK_ACTIVITY
  • Android.intent.action.RINGTONE_PICKER
  • Android.intent.action.RUN
  • Android.intent.action.SEARCH
  • Android.intent.action.SEARCH_LONG_PRESS
  • Android.intent.action.SEND
  • Android.intent.action.SENDTO
  • Android.intent.action.SET_WALLPAPER
  • Android.intent.action.SYNC
  • Android.intent.action.SYSTEM_TUTORIAL
  • Android.intent.action.VIEW
  • Android.intent.action.VOICE_COMMAND
  • Android.intent.action.WEB_SEARCH
  • Android.net.wifi.PICK_WIFI_NETWORK
  • Android.settings.AIRPLANE_MODE_SETTINGS
  • Android.settings.APN_SETTINGS
  • Android.settings.APPLICATION_DEVELOPMENT_SETTINGS
  • Android.settings.APPLICATION_SETTINGS
  • Android.settings.BLUETOOTH_SETTINGS
  • Android.settings.DATA_ROAMING_SETTINGS
  • Android.settings.DATE_SETTINGS
  • Android.settings.DISPLAY_SETTINGS
  • Android.settings.INPUT_METHOD_SETTINGS
  • Android.settings.INTERNAL_STORAGE_SETTINGS
  • Android.settings.LOCALE_SETTINGS
  • Android.settings.LOCATION_SOURCE_SETTINGS
  • Android.settings.MANAGE_APPLICATIONS_SETTINGS
  • Android.settings.MEMORY_CARD_SETTINGS
  • Android.settings.NETWORK_OPERATOR_SETTINGS
  • Android.settings.QUICK_LAUNCH_SETTINGS
  • Android.settings.SECURITY_SETTINGS
  • Android.settings.SETTINGS
  • Android.settings.SOUND_SETTINGS
  • Android.settings.SYNC_SETTINGS
  • Android.settings.USER_DICTIONARY_SETTINGS
  • Android.settings.WIFI_IP_SETTINGS
  • Android.settings.WIFI_SETTINGS
  • Android.settings.WIRELESS_SETTINGS

Android Intent and intent action Daquan

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.