Android系统基本功能

来源:互联网 发布:域名能干什么 编辑:程序博客网 时间:2024/05/19 08:25

打电话

 

Code

Uri uri =Uri.parse("tel:15800001234");Intentintent = new Intent(Intent.ACTION_CALL, uri);startActivity(intent);

 

权限:

<uses-permissionandroid:name="android.permission.CALL_PHONE" />



发短信

Code

<span style="white-space:pre"></span>Uriuri = Uri.parse("smsto:15800001234");<span style="white-space:pre"></span>Intentintent = new Intent(Intent.ACTION_SENDTO, uri);<span style="white-space:pre"></span>intent.putExtra("sms_body","android...");<span style="white-space:pre"></span>startActivity(intent);

 

权限:

<uses-permissionandroid:name="android.permission.SEND_SMS"/>



安装APK

 <span style="white-space:pre"></span>FileapkFile = new File("mnt/sdcard/tts_3.1_market.apk");<span style="white-space:pre"></span>Intentintent = new Intent();<span style="white-space:pre"></span>intent.setAction(Intent.ACTION_VIEW);<span style="white-space:pre"></span><span style="white-space:pre"></span>intent.setDataAndType(Uri.fromFile(apkFile),"application/vnd.android.package-archive"); <span style="white-space:pre"></span>startActivity(intent); 


文件浏览

FiledirFile = new File("指定的目录");

File[] files =dirFile.listFiles(); 


系统音乐播放器

<span style="white-space:pre"></span>Intent intent = newIntent();<span style="white-space:pre"></span>Uri uri =Uri.parse(url);<span style="white-space:pre"></span>intent.setDataAndType(uri,"audio/*"); <span style="white-space:pre"></span>intent.setAction(Intent.ACTION_VIEW);<span style="white-space:pre"></span>startActivity(intent); 

 

0 0