Android系统在设计之初就强调重视组件的概念,轻视应用的概念。每一个App都不是互相独立的,而是以一种组件化地对外对内提供服务,App间的交互很多,比如跨应用获取数据,跳转页面等。

今天这篇文章就来做一个大汇总,记录常用的跳转系统界面的代码。总共52条,后续可能会少量补充。

老规矩,在节目开始之前,先来一个搞笑段子:
同事嫖娼被抓,拘留15天,他老婆冲到派出所大吵大骂。他同事淡定地过去劝说:“嫂子你听我说,大哥昨晚喝多了,我们不让他走,他说老婆在家等呢,坚持要回去,结果被查了酒驾。按法律要关6个月,还要重考驾照。我们找了很多关系才改成嫖娼。”她老婆瞬间感动,临走时还不停地说:“谢谢,谢谢啊!”

<本文主要测试机型:Google Nexus5>

<主要包括两大部分:Setting及其子页面、系统App>

1、跳转Setting应用列表(所有应用)

Intent intent =  new Intent(Settings.ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS);this.startActivity(intent);

2、跳转Setting应用列表(安装应用)

Intent intent =  new Intent(Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS);

3、跳转Setting应用列表

Intent intent =  new Intent(Settings.ACTION_APPLICATION_SETTINGS);

4、开发者选项

Intent intent =  new Intent(Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS);

5、允许在其它应用上层显示的应用

Intent intent =  new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION);

6、无障碍设置

Intent intent =  new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);

7、添加账户

Intent intent =  new Intent(Settings.ACTION_ADD_ACCOUNT);

8、WIFI设置

Intent intent =  new Intent(Settings.ACTION_WIFI_SETTINGS);

9、蓝牙设置

Intent intent =  new Intent(Settings.ACTION_BLUETOOTH_SETTINGS);

10、移动网络设置

Intent intent =  new Intent(Settings.ACTION_DATA_ROAMING_SETTINGS);

11、日期时间设置

Intent intent =  new Intent(Settings.ACTION_DATE_SETTINGS);

12、关于手机界面

Intent intent =  new Intent(Settings.ACTION_DEVICE_INFO_SETTINGS);

13、显示设置界面

Intent intent =  new Intent(Settings.ACTION_DISPLAY_SETTINGS);

14、声音设置

Intent intent =  new Intent(Settings.ACTION_SOUND_SETTINGS);

15、互动屏保

Intent intent =  new Intent(Settings.ACTION_DREAM_SETTINGS);

16、输入法

Intent intent =  new Intent(Settings.ACTION_INPUT_METHOD_SETTINGS);

17、输入法_SubType

Intent intent =  new Intent(Settings.ACTION_INPUT_METHOD_SUBTYPE_SETTINGS);

18、内部存储设置界面

Intent intent =  new Intent(Settings.ACTION_INTERNAL_STORAGE_SETTINGS);

19、存储卡设置界面

Intent intent =  new Intent(Settings.ACTION_MEMORY_CARD_SETTINGS);

20、语言选择界面

Intent intent =  new Intent(Settings.ACTION_LOCALE_SETTINGS);

21、位置服务界面

Intent intent =  new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);

22、运营商

Intent intent =  new Intent(Settings.ACTION_NETWORK_OPERATOR_SETTINGS);

23、NFC共享界面

Intent intent =  new Intent(Settings.ACTION_NFCSHARING_SETTINGS);

24、NFC设置

Intent intent =  new Intent(Settings.ACTION_NFC_SETTINGS);

25、备份和重置

Intent intent =  new Intent(Settings.ACTION_PRIVACY_SETTINGS);

26、快速启动

Intent intent =  new Intent(Settings.ACTION_QUICK_LAUNCH_SETTINGS);

27、搜索设置

Intent intent =  new Intent(Settings.ACTION_SEARCH_SETTINGS);

28、安全设置

Intent intent =  new Intent(Settings.ACTION_SECURITY_SETTINGS);

29、设置的主页

Intent intent =  new Intent(Settings.ACTION_SETTINGS);

30、用户同步界面

Intent intent =  new Intent(Settings.ACTION_SYNC_SETTINGS);

31、用户字典

Intent intent =  new Intent(Settings.ACTION_USER_DICTIONARY_SETTINGS);

32、IP设置

Intent intent =  new Intent(Settings.ACTION_WIFI_IP_SETTINGS);

33、App设置详情界面

public void startAppSettingDetail() {   String packageName = getPackageName();    Uri packageURI = Uri.parse("package:" + packageName);    Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);    intent.setData(packageURI);    startActivity(intent);}

34、跳转应用市场

public void startMarket() {    Intent intent = new Intent(Intent.ACTION_VIEW);//  intent.setData(Uri.parse("market://details?id=" + "com.xxx.xxx"));    intent.setData(Uri.parse("market://search?q=App Name"));    startActivity(intent);}

35、获取Launcherbaoming

public void getLauncherPackageName() {   Intent intent = new Intent(Intent.ACTION_MAIN);    intent.addCategory(Intent.CATEGORY_HOME);    final ResolveInfo res = this.getPackageManager().resolveActivity(intent, 0);    if (res.activityInfo == null) {        Log.e("TAG", "没有获取到");        return;    }    if (res.activityInfo.packageName.equals("android")) {        Log.e("TAG", "有多个Launcher,且未指定默认");    } else {        Log.e("TAG", res.activityInfo.packageName);    }}

36、跳转图库获取图片

public void startGallery() {  Intent intent = new Intent(Intent.ACTION_PICK,            android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);    intent.setType("image/*");    this.startActivityForResult(intent, 1);}

37、跳转相机,拍照并保存

public void startCamera() { String dir = Environment.getExternalStorageDirectory().getAbsolutePath() + "/test.jpg";    Uri headCacheUri = Uri.fromFile(new File(dir));    Intent takePicIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);    takePicIntent.putExtra(MediaStore.EXTRA_OUTPUT, headCacheUri);    startActivityForResult(takePicIntent, 2);}

38、跳转文件管理器

public void startFileManager() {Intent intent = new Intent(Intent.ACTION_GET_CONTENT,            android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);    intent.setType("file/*");    this.startActivityForResult(intent, 3);}

39、直接拨打电话

public void startCall() { Intent callIntent = new Intent(Intent.ACTION_CALL);    callIntent.setData(Uri.parse("tel:" + "13843894038"));    if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {        return;    }    startActivity(callIntent);}

40、跳转电话应用

public void startPhone() {Intent intent = new Intent(Intent.ACTION_DIAL,Uri.parse("tel:" + "13843894038"));    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);    startActivity(intent);}

41、发送短信

public void startSMS() {    Uri smsToUri = Uri.parse("smsto://10086");    Intent mIntent = new Intent( android.content.Intent.ACTION_SENDTO, smsToUri );    startActivity(mIntent);}

42、发送彩信

public void startMMS() { Uri uri = Uri.parse("content://media/external/images/media/11");    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);}

43、发送邮件

public void startEmail() {   Uri uri = Uri.parse("mailto:6666666@qq.com");    String[] email = {"12345678@qq.com"};    Intent intent = new Intent(Intent.ACTION_SENDTO, uri);    intent.putExtra(Intent.EXTRA_CC, email); // 抄送人    intent.putExtra(Intent.EXTRA_SUBJECT, "这是邮件的主题部分"); // 主题    intent.putExtra(Intent.EXTRA_TEXT, "这是邮件的正文部分"); // 正文    startActivity(Intent.createChooser(intent, "请选择邮件类应用"));}

44、跳转联系人

public void startContact() {  Intent intent = new Intent();    intent.setAction(Intent.ACTION_VIEW);    intent.setData(Contacts.People.CONTENT_URI);    startActivity(intent);    /*Intent intent = new Intent();    intent.setAction(Intent.ACTION_PICK);    intent.setData(Uri.parse("content://contacts/people"));    startActivityForResult(intent, 5);*/}

45、插入联系人

public void insertContact() {  Intent intent = new Intent(Intent.ACTION_INSERT);    intent.setData(ContactsContract.Contacts.CONTENT_URI);    intent.putExtra(ContactsContract.Intents.Insert.PHONE, "18688888888");    startActivityForResult(intent, 1);}

46、插入日历事件

public void startCalender() { Intent intent = new Intent(Intent.ACTION_INSERT);    intent.setData(CalendarContract.Events.CONTENT_URI);    intent.putExtra(CalendarContract.Events.TITLE, "开会");    startActivityForResult(intent, 1);}

47、跳转浏览器

public void startBrowser() {  Uri uri = Uri.parse("http://www.baidu.com");    Intent intent = new Intent(Intent.ACTION_VIEW,uri);    startActivity(intent);}

48、安装应用

public void startInstall() { String filePath="/xx/xx/abc.apk";    Intent intent = new  Intent(Intent.ACTION_VIEW);    intent.setDataAndType(Uri.parse("file://" + filePath),            "application/vnd.android.package-archive");    startActivity(intent);}

49、卸载应用

public void startUnInstall() {  String packageName="cn.memedai.mas.debug";    Uri packageUri = Uri.parse("package:"+packageName);//包名,指定该应用    Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageUri);    startActivity(uninstallIntent);}

50、回到桌面

public void startLauncherHome() {  Intent intent = new Intent(Intent.ACTION_MAIN);    intent.addCategory(Intent.CATEGORY_HOME);    startActivity(intent);}

51、打开任意文件(根据其MIME TYPE自动选择打开的应用)

private void openFile(File f) {    Intent intent = new Intent();    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);    intent.setAction(android.content.Intent.ACTION_VIEW);    String type = getMIMEType(f);    intent.setDataAndType(Uri.fromFile(f), type);    startActivity(intent);}private String getMIMEType(File f) {    String end = f.getName().substring(f.getName().lastIndexOf(".") + 1,            f.getName().length()).toLowerCase();    String type = "";    if (end.equalsIgnoreCase("mp3")            || end.equalsIgnoreCase("aac")            || end.equalsIgnoreCase("amr")            || end.equalsIgnoreCase("mpeg")            || end.equalsIgnoreCase("mp4")) {        type = "audio";    } else if(end.equalsIgnoreCase("mp4")            || end.equalsIgnoreCase("3gp")            || end.equalsIgnoreCase("mpeg4")            || end.equalsIgnoreCase("3gpp")            || end.equalsIgnoreCase("3gpp2")            || end.equalsIgnoreCase("flv")            || end.equalsIgnoreCase("avi")) {        type = "video";    } else if (end.equalsIgnoreCase("jpg")            || end.equalsIgnoreCase("gif")            || end.equalsIgnoreCase("bmp")            || end.equalsIgnoreCase("png")            || end.equalsIgnoreCase("jpeg")) {        type = "image";    } else {        type = "*";    }    type += "/*";    return type;}

52、跳转录音

public void startRecord() { Intent intent = new Intent(MediaStore.Audio.Media.RECORD_SOUND_ACTION);    startActivity(intent);}

目前就先写这么多,有新的后续再补充。
如果这篇文章对你有帮助就赞一个吧!

本期节目就到这里,感谢您的收看,我们下期再见~

更多相关文章

  1. Android(安卓)UI总结 Android(安卓)和H5 字体大小适配
  2. [置顶] Android(安卓)popwindow和fragment结合 左侧弹出下拉菜单
  3. android HOME、back(按钮、事件)截取获得,综合解决方案和分析,包含an
  4. Android(安卓)酷炫来袭:制作属于你自己的音频播放器(综合运用Media
  5. Android获取不同手机 自身存储和外置SD卡存储路径的解决方案
  6. android下调试声卡驱动之wm8960介绍一
  7. Android(安卓)如何获取应用签名,微信需要的签名是MD5还是SHA1?
  8. 八大Android土鳖设计
  9. Android(安卓)View获取坐标值、相对距离的方法

随机推荐

  1. Android 字体修改
  2. ubuntu下Qt之android环境配置以及一些常
  3. android 日志打印器 LogUtil
  4. Android 下拉刷新控件的使用
  5. Android(安卓)7.1.1 去除Launcher3的抽屉
  6. Android 横竖屏切换的Activity生命周期演
  7. android笔记 AIDL 实现进程间通信
  8. 创建android逐帧动画的两种方式 布局和ja
  9. Android(安卓)Bitmap zoomIn/zoomOut/rot
  10. 【转】Android 多渠道打包:使用Gradle和An