2024年1月2日发(作者:)

{".prop", "text/plain"},

{".rc", "text/plain"},

{".rmvb", "audio/x-pn-realaudio"},

{".rtf", "application/rtf"},

{".sh", "text/plain"},

{".tar", "application/x-tar"},

{".tgz", "application/x-compressed"},

{".txt", "text/plain"},

{".wav", "audio/x-wav"},

{".wma", "audio/x-ms-wma"},

{".wmv", "audio/x-ms-wmv"},

{".wps", "application/-works"},

{".xml", "text/plain"},

{".z", "application/x-compress"},

{".zip", "application/x-zip-compressed"},

{"", "*/*"}

};

这个MIME类型可能不够完整,你有要补充的吗?

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------1. Intent open a picture file public:

Java代码

1. Intent intent = new Intent("");

2. egory("T");

3. gs (_ACTIVITY_NEW_TASK);

4. Uri uri = le(new

5. File("/mnt/sdcard/images/"));

6. aAndType (uri, "image/*");

7. ctivity(intent);

2. Intent to open a PDF file:

Java代码

1. Intent intent = new Intent("");

2. egory("T");

3. gs (_ACTIVITY_NEW_TASK);

4. Uri uri = le(new

5. File("file:///android_asset/"));

6. aAndType (uri, "application/pdf");

7. ctivity(intent);

3. Intent to open a text file:

Java代码

1. Intent intent = new Intent("");

2. egory("T");

3. gs (_ACTIVITY_NEW_TASK);

4. if (paramBoolean)

5. {

6. Uri uri1 = (param);

7. aAndType (URI1, "text/plain");

8. }

9. else

10. {

11. Uri uri = le(new File("/mnt/sdcard/"));

12. aAndType (URI2, "text/plain");

13. }

14. ctivity(intent);

4. Intent to open the audio file:

Java代码

1. Intent intent = new Intent("");

2. gs(_ACTIVITY_CLEAR_TOP);

3. ra ("oneshot", 0);

4. ra ("configchange", 0);

5. Uri uri = le(new File("/mnt/sdcard/3"));

6. aAndType (uri, "audio/*");

7. ctivity(intent);

5. Intent to open the video file:

Java代码

1. Intent intent = new Intent("");

2. gs(_ACTIVITY_CLEAR_TOP);

3. ra ("oneshot", 0);

4. ra ("configchange", 0);

5. Uri uri = le(new File("/mnt/sdcard/"));

6. aAndType (uri, "video/*");

7. ctivity(intent);

6. Intent to open the CHM file:

Java代码

1. Intent intent = new Intent("");

2. egory("T");

3. gs (_ACTIVITY_NEW_TASK);

4. Uri uri = le(new File("/mnt/sdcard/"));

5. aAndType (uri, "application / x-chm");

6. ctivity(intent);

7. Intent to open a Word document:

Java代码

1. Intent intent = new Intent("");

2. egory("T");

3. gs (_ACTIVITY_NEW_TASK);

4. Uri uri = le(new File("/system/etc/"));

5. aAndType(uri, "application/msword");

6. ctivity(intent);

8. Android Excel intent:

Java代码

1. Intent intent = new Intent("");

2. egory("T");

3. gs (_ACTIVITY_NEW_TASK);

4. Uri uri = le(new File("/mnt/sdcard/"));

5. aAndType (uri, "application/-excel");

6. ctivity(intent);

9. Intent to open the PPT file:

Java代码

1. Intent intent = new Intent("");

2. egory("T");

3. gs (_ACTIVITY_NEW_TASK);

4. Uri uri = le(new

5. File("/mnt/sdcard/download/Android_"));

6. aAndType (uri, "application/-powerpoint");

7. ctivity(intent);

10. Display Html page::

Java代码

1. Uri uri = ("");

2. Intent intent = new Intent (_VIEW, uri);

3. ctivity(intent);

11. Show map:

Java代码

1. Uri uri = ("geo: 38.899533, -77.036476");

2. Intent intent = new Intent (_VIEW, uri);

3. ctivity(intent);

12. Call the dialer:

Java代码

1. Uri uri = ("tel: xxxxxx");

2. Intent intent = new Intent (_DIAL, uri);

3. ctivity(intent);

13. Call :

Java代码

1. Uri uri = ("tel: xxxxxx");

2. Intent it = new Intent (_CALL, uri);

3. ctivity(intent);

4. /*permission:

5.

6. */

14. Call to send text messages of the program :

Java代码

1. Intent intent = new Intent (_VIEW);

2. ra("sms_body", "The SMS text");

3. e("d-dir/mms-sms");

4. ctivity(intent);

15. Send SMS :

Java代码

1. Uri uri = ("smsto:");

2. Intent intent = new Intent(_SENDTO, uri);

3. ra("sms_body", "The SMS text");

4. ctivity(intent);

16. Send MMS :

Java代码

1. Uri uri = ("content://media/external/images/media/23");

2. Intent intent = new Intent(_SEND);

3. ra("sms_body", "some text");

4. ra(_STREAM, uri);

5. e("image/png");

6. ctivity(intent);

17. Send an Email :

Java代码

1. Uri uri = ("mailto: xxx@");

2. Intent intent = new Intent (_SENDTO, uri);

3. ctivity(intent);

18. Send an Email with body :

Java代码

1. Intent intent = new Intent(_SEND);

2. ra(_EMAIL,"me@");

3. ra(_TEXT,"The email body text");

4. e ("text/plain");

5. ctivity(

6. Chooser(intent, "Choose Email Client"));

19. Send an Email with body,to,cc :

Java代码

1. Intent intent = new Intent(_SEND);

2. String [] tos ={"me@"};

3. String [] ccs ={"you@"};

4. ra(_EMAIL, tos);

5. ra(_CC, ccs);

6. ra(_TEXT, "The email body text");

7. ra(_SUBJECT, "The email subject text");

8. e("message/rfc822");

9. ctivity(

10. Chooser(intent, "Choose Email Client"));

20. Send an Email with attachments :

Java代码

1. Intent intent = new Intent(_SEND);

2. ra(_SUBJECT,"The email subject text");

3. ra(_STREAM,"file :///sdcard/3");

4. e("audio/mp3");

5. ctivity(

6. Chooser(intent,"Choose Email Client"));

21. Uninstall the program :

Java代码

1. Uri uri = rts ("package", strPackageName, null);

2. Intent intent = new Intent (_DELETE, uri);

3. ctivity(

4. Chooser(intent,"Choose Email Client"));

22. Install the apk :

Java代码

1. Uri installUri = rts("package", "xxx", null);

2. returnIt = new Intent(_PACKAGE_ADDED, installUri);

3. ctivity(returnIt);

23. Search applications :

Java代码

1. Uri uri = ("market://search?Q=pname:pkg_name");

2. Intent intent = new Intent(_VIEW, uri);

3. ctivity(intent);

4. //Where pkg_name is the full package path for an application

24. Google Search Launch Web Browser :

Java代码

1. Intent intent = new Intent(_WEB_SEARCH);

2. String term = "Android";

3. ra(, term);

4. ctivity(intent);

25. Send text using Intent (to messaging apps) :

Java代码

1. Intent intent = new Intent(_WEB_SEARCH);

2. String msgBody = "This is message";

3. Intent intent = new Intent(_SEND);

4. e("text/plain");

5. ra(_SUBJECT,

6. "message subject");

7. ra(_TEXT, msgBody);

8. ctivity(Chooser(intent, getResources().

9. getString(_by_using)));

26. Create Shortcut on "Home Screen" :

Java代码

1. Intent intent = new Intent(_WEB_SEARCH);

2. Intent toPrint = new Intent(this, );

3. Intent addShortcut = new Intent

4. ("L_SHORTCUT");

5. ra(_SHORTCUT_NAME, "Shutcutname");

6. ra(_SHORTCUT_INTENT, toPrint);

7. ra(_SHORTCUT_ICON_RESOURCE,

8. ntext(this, ));

9.

10. Manifest file:

11.

12.

13.

14.

15. 16. L_SHORTCUT">

17.