admin管理员组文章数量:1531268
2024年7月21日发(作者:)
{".3gp", "video/3gpp"},
{".apk", "application/e-archive"},
{".asf", "video/x-ms-asf"},
{".avi", "video/x-msvideo"},
{".bin", "application/octet-stream"},
{".bmp", "image/bmp"},
{".c", "text/plain"},
{".class", "application/octet-stream"},
{".conf", "text/plain"},
{".cpp", "text/plain"},
{".doc", "application/msword"},
{".docx", "application/nt"},
{".xls", "application/-excel"},
{".xlsx", "application/"},
{".exe", "application/octet-stream"},
{".gif", "image/gif"},
{".gtar", "application/x-gtar"},
{".gz", "application/x-gzip"},
{".h", "text/plain"},
{".htm", "text/html"},
{".html", "text/html"},
{".jar", "application/java-archive"},
{".java", "text/plain"},
{".jpeg", "image/jpeg"},
{".jpg", "image/jpeg"},
{".js", "application/x-javascript"},
{".log", "text/plain"},
{".m3u", "audio/x-mpegurl"},
{".m4a", "audio/mp4a-latm"},
{".m4b", "audio/mp4a-latm"},
{".m4p", "audio/mp4a-latm"},
{".m4u", "video/l"},
{".m4v", "video/x-m4v"},
{".mov", "video/quicktime"},
{".mp2", "audio/x-mpeg"},
{".mp3", "audio/x-mpeg"},
{".mp4", "video/mp4"},
{".mpc", "application/icate"},
{".mpe", "video/mpeg"},
{".mpeg", "video/mpeg"},
{".mpg", "video/mpeg"},
{".mpg4", "video/mp4"},
{".mpga", "audio/mpeg"},
{".msg", "application/-outlook"},
{".ogg", "audio/ogg"},
{".pdf", "application/pdf"},
{".png", "image/png"},
{".pps", "application/-powerpoint"},
{".ppt", "application/-powerpoint"},
{".pptx", "application/tation"},
{".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"},
{"", "*/*"}
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/-powerpoin
t");
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/medi
a/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 t
ext");
3. ra(_STREAM,"file :///sdcard/myso
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, instal
lUri);
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 applicat
ion
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, msgBod
y);
8. ctivity(Chooser(intent, getRe
sources().
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, "Shutcut
name");
6. ra(_SHORTCUT_INTENT, toPrin
t);
7. ra(_SHORTCUT_ICON_RESOURCE,
8. ntext(this, le.
icon));
9.
10. Manifest file:
11.
12.
13.
14.
15.
17.
版权声明:本文标题:android打开各种类型文件 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dongtai/1721548563a884403.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论