android Intent 多种用法全面介绍
2010-06-04 14:20:00 来源:WEB开发网播放多媒体
1. Intent it = new Intent(Intent.ACTION_VIEW);
2. Uri uri = Uri.parse("file:///sdcard/song.mp3");
3. it.setDataAndType(uri, "audio/mp3");
4. startActivity(it);
1. Uri uri = Uri.withAppendedPath(MediaStore.Audio.Media.INTERNAL_CONTENT_URI, "1");
2. Intent it = new Intent(Intent.ACTION_VIEW, uri);
3. startActivity(it);
Uninstall 程序
1. Uri uri = Uri.fromParts("package", strPackageName, null);
2. Intent it = new Intent(Intent.ACTION_DELETE, uri);
3. startActivity(it);
Install 程序
1. Uri installUri = Uri.fromParts("package", "xxx", null);
2. returnIt = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri);
搜索应用
1. //搜索应用
2. Uri uri = Uri.parse("market://search?q=pname:pkg_name");
3. Intent it = new Intent(Intent.ACTION_VIEW, uri);
4. startActivity(it);
5. //where pkg_name is the full package path for an application
6.
7. //显示指定应用的详细页面(这个好像不支持了,找不到app_id)
8. Uri uri = Uri.parse("market://details?id=app_id");
9. Intent it = new Intent(Intent.ACTION_VIEW, uri);
10. startActivity(it);
11. //where app_id is the application ID, find the ID
12. //by clicking on your application on Market home
13. //page, and notice the ID from the address bar
更多精彩
赞助商链接