Android开发之Intent跳转到系统应用中的拨号界面、联系人界面、短信界面 .相机.录影机....

2023-05-16

Android开发之Intent跳转到系统应用中的拨号界面、联系人界面、短信界面

现在开发中的功能需要直接跳转到拨号、联系人、短信界面等等,查找了很多资料,自己整理了一下。

//安装已经存在的apk
String filePath="mnt/sdcard/abc.apk";
Intent intent = new  Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse("file://" + filePath),
		"application/vnd.android.package-archive");
startActivity(intent);//直接跳到安装页面,但是还要点击按钮确定安装,还是取消安装

//卸载某应用
 Uri packageUri = Uri.parse("package:io.kos.antiguard");//包名
 Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageUri);
  startActivity(uninstallIntent);

2.浏览网页某一具体网址
2.浏览网页某一具体网址
2.浏览网页某一具体网址
2.浏览网页某一具体网址
 Uri uri = Uri.parse("http://xxxxxxxxxxxxxxxxxxxxxxxx");   
  Intent intent   = new Intent(Intent.ACTION_VIEW,uri);
//加下面这句话就是启动系统自带的浏览器打开上面的网址,  不加下面一句话,  如果你有多个浏览器,就会弹出让你选择某一浏览器, 然后改浏览器就会打开该网址...............
intent.setClassName("com.android.browser", "com.android.browser.BrowserActivity");  
 startActivity(intent);

//启动设置界面
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(ComponentName.unflattenFromString("com.android.settings/.DevelopmentSettings"));
intent.addCategory("android.intent.category.LAUNCHER");
startActivity(intent);

//回到桌面吗
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
startActivity(intent);
          
//启动拨号界面
Intent intent =new Intent();  
intent.setAction("android.intent.action.CALL_BUTTON");  
startActivity(intent);
//拨号
 Uri uri = Uri.parse("tel:xxxxxx");    
 Intent intent = new Intent(Intent.ACTION_DIAL, uri);       
 startActivity(intent);  
 
//启动拨号界面,指定了类名  包名   是系统的拨号界面
Intent intent= new Intent("android.intent.action.DIAL");   
 intent.setClassName("com.android.contacts","com.android.contacts.DialtactsActivity");
startActivity(intent);  

 //启动联系人界面,指定了包名  类名  是系统的 
Intent intent= new Intent("com.android.contacts.action.LIST_STREQUENT");   
 intent.setClassName("com.android.contacts","com.android.contacts.DialtactsActivity");
startActivity(intent);

 //启动联系人界面
Intent intent = new Intent();   
 intent.setAction(Intent.ACTION_PICK);   
 intent.setData(Contacts.People.CONTENT_URI);   
 startActivity(intent);

插入联系人


Intent intent=new Intent(Intent.ACTION_EDIT,Uri.parse("content://com.android.contacts/contacts/"+"1"));  
 startActivity(intent);  
到联系人列表界面

Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT);  
  
             intent.setType("vnd.android.cursor.item/person");  
  
             intent.setType("vnd.android.cursor.item/contact");  
  
             intent.setType("vnd.android.cursor.item/raw_contact");  
  
             intent.putExtra(android.provider.ContactsContract.Intents.Insert.NAME, name);  
  
             intent.putExtra(android.provider.ContactsContract.Intents.Insert.COMPANY,company);  
  
             intent.putExtra(android.provider.ContactsContract.Intents.Insert.PHONE, tel);  
  
             intent.putExtra(android.provider.ContactsContract.Intents.Insert.PHONE_TYPE, 3);

//启动短信收件箱的界面,指定了包名,类名
		 Intent intent = new Intent();
	        intent.setClassName("com.android.mms","com.android.mms.ui.ConversationList");
	        intent.setAction(Intent.ACTION_MAIN);
	        intent.addCategory(Intent.CATEGORY_LAUNCHER);
	        startActivity(intent);

 //启动编辑短信的界面
Intent intent = new Intent(Intent.ACTION_VIEW);  
intent.setType("vnd.android-dir/mms-sms");   
 // intent.setData(Uri.parse("content://mms-sms/conversations/"));//此为号码  
  startActivity(intent);

剩余Intent跳转:见网址:

http://my.eoe.cn/803369/archive/1641.html

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Android开发之Intent跳转到系统应用中的拨号界面、联系人界面、短信界面 .相机.录影机.... 的相关文章

随机推荐