【Android】Android intent 系统调用大全
16lz
2021-01-23
Intent, 用 法
Intent应该算是Android中特有的东西。你 可以在Intent中指定程序要执行的动作(比 如:view,edit,dial),以及程序执行到该动作时所需要的资料。都指定好后,只要调用 startActivity(),Android系统会自动寻找最符合你指定要求的应用程序,并执行该程序。 下面列出几种Intent的用法 显示网页:
调用拨号程序
调用发送短信的程序
|
uninstall apk
- Uri uninstallUri = Uri.fromParts("package", "xxx", null);
- returnIt = new Intent(Intent.ACTION_DELETE, uninstallUri);
install apk
- Uri installUri = Uri.fromParts("package", "xxx", null);
- returnIt = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri);
play audio
- Uri playUri = Uri.parse("file:///sdcard/download/everything.mp3");
- returnIt = new Intent(Intent.ACTION_VIEW, playUri);
- //发送附件
- Intent it = new Intent(Intent.ACTION_SEND);
- it.putExtra(Intent.EXTRA_SUBJECT, "The email subject text");
- it.putExtra(Intent.EXTRA_STREAM, "file:///sdcard/eoe.mp3");
- sendIntent.setType("audio/mp3");
- startActivity(Intent.createChooser(it, "Choose Email Client"));
- //搜索应用
- 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
- //显示指定应用的详细页面(这个好像不支持了,找不到app_id)
- 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 on Market home
- //page, and notice the ID from the address bar
更多相关文章
- Android系统集成第三方pre-build库和程序
- Android 动态加载APK--代码安装、获取安装包中的资源及Intent调
- [Android设计模式]Android退出应用程序终极方法
- 浅谈Android开机启动速度优化(含应用程序启动速度优化)
- 使用Scala编写Android应用程序
- 如何在自己的程序中添加appWidget(附简单代码)