Intent intent = new Intent(); ComponentName comp = new ComponentName("com.tencent.mobileqq", "com.tencent.mobileqq.activity.SplashActivity"); intent.setComponent(comp); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent);
系统应用
搜索内容
1 2 3 4
Intent intent = new Intent(); intent.setAction(Intent.ACTION_WEB_SEARCH); intent.putExtra(SearchManager.QUERY,"搜索内容") startActivity(intent);
打开网页
1 2 3
Uri uri = Uri.parse("https://www.baidu.com"); Intent intent = new Intent(Intent.ACTION_VIEW,uri); startActivity(intent);
查看地图
1 2 3
Uri uri = Uri.parse("geo:36.899533,66.036476"); Intent intent = newIntent(Intent.Action_VIEW,uri); startActivity(intent);
拨打电话
1 2 3
Uri uri = Uri.parse("tel:10086"); Intent intent = new Intent(Intent.ACTION_DIAL,uri); startActivity(intent);
发送短信
1 2 3 4
Uri uri = Uri.parse("smsto:10086"); Intent intent = new Intent(Intent.ACTION_SENDTO, uri); intent.putExtra("sms_body", "CXLL(Content)"); startActivity(intent);
发邮件
1 2 3
Uri uri = Uri.parse("mailto:123456@qq.com"); Intent intent = new Intent(Intent.ACTION_SENDTO, uri); startActivity(intent);
播放媒体
1 2 3 4
Intent intent = new Intent(Intent.ACTION_VIEW); Uri uri = Uri.parse("file:///sdcard0/aLIEz.mp3"); intent.setDataAndType(uri,"audio/mp3"); startActivity(intent);
系统设置
1 2
Intent intent = new Intent(android.provider.Settings.ACTION_SETTINGS); startActivity(intent);
拍照
1 2 3 4 5 6 7
// 打开照相机 Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(intent, 1);