使用系统自带的浏览器应用程序Gallery可以打开一张指定的,
//使用Intent
Intent intent = new Intent(IntentACTION_VIEW);
//Uri mUri = Uriparse("file://" + picFilegetPath());Android30以后最好不要通过该方法,存在一些小Bug
intentsetDataAndType(UrifromFile(picFile), "image/");
startActivity(intent)
显示网页:
1 Uri uri = Uriparse("");
2 Intent it = new Intent(IntentACTION_VIEWuri);
3 startActivity(it);123123
显示地图:
1 Uri uri = Uriparse("geo:38-77");
2 Intent it = new Intent(IntentAction_VIEWuri);
3 startActivity(it);123123
路径规划:
1 Uri uri = Uriparse("");
2 Intent it = new Intent(IntentACTION_VIEWURI);
3 startActivity(it);123123
拨打电话:
调用拨号程序
1 Uri uri = Uriparse("tel:xxxxxx");
2 Intent it = new Intent(IntentACTION_DIAL uri);
3 startActivity(it);
4 1 Uri uri = Uriparse("telxxxxxx");
2 Intent it =new Intent(IntentACTION_CALLuri);
3 要运用这个必须在配置文件中加入12345671234567
发送SMS/MMS
调用发送短信的程序
1 Intent it = new Intent(IntentACTION_VIEW);
2 itputExtra("sms_body" "The SMS text");
3 itsetType("vndandroid-dir/mms-sms");
4 startActivity(it);1234512345
发送短信
1 Uri uri = Uriparse("smsto:03");
2 Intent it = new Intent(IntentACTION_SENDTO uri);
3 itputExtra("sms_body" "The SMS text");
4 startActivity(it);12341234
发送彩信
1 Uri uri = Uriparse("content://media/external/images/media/23");
2 Intent it = new Intent(IntentACTION_SEND);
3 itputExtra("sms_body" "some text");
4 itputExtra(IntentEXTRA_STREAM uri);
5 itsetType("image/png");
6 startActivity(it);123456123456
发送Email
1
2 Uri uri = Uriparse("mailto:");
3 Intent it = new Intent(IntentACTION_SENDTO uri);
4 startActivity(it);
1 Intent it = new Intent(IntentACTION_SEND);
2 itputExtra(IntentEXTRA_EMAIL "");
3 itputExtra(IntentEXTRA_TEXT "The email body text");
4 itsetType("text/plain");
5 startActivity(IntentcreateChooser(it "Choose Email Client"));
1 Intent it=new Intent(IntentACTION_SEND);
2 String[] tos={""};
3 String[] ccs={""};
4 itputExtra(IntentEXTRA_EMAIL tos);
5 itputExtra(IntentEXTRA_CC ccs);
6 itputExtra(IntentEXTRA_TEXT "The email body text");
7 itputExtra(IntentEXTRA_SUBJECT "The email subject text");
8 itsetType("message/rfc822");
9 startActivity(IntentcreateChooser(it "Choose Email Client"));12345678910111213141516171819201234567891011121314151617181920
添加附件
1 Intent it = new Intent(IntentACTION_SEND);
2 itputExtra(IntentEXTRA_SUBJECT "The email subject text");
3 itputExtra(IntentEXTRA_STREAM "file:///sdcard/mysongmp3");
4 sendIntentsetType("audio/mp3");
5 startActivity(IntentcreateChooser(it "Choose Email Client"));123456123456
播放多媒体
1
2 Intent it = new Intent(IntentACTION_VIEW);
3 Uri uri = Uriparse("file:///sdcard/songmp3");
4 itsetDataAndType(uri "audio/mp3");
5 startActivity(it);
1 Uri uri = UriwithAppendedPath(MediaStoreAudioMediaINTERNAL_CONTENT_URI "1");
2 Intent it = new Intent(IntentACTION_VIEW uri);
3 startActivity(it);123456789123456789
Uninstall 程序
1 Uri uri = UrifromParts("package" strPackageName null);
2 Intent it = new Intent(IntentACTION_DELETE uri);
3 startActivity(it);12341234
安装指定apk
进入联系人页面
Intent intent=newIntent();
intentsetAction(IntentACTION_VIEW);
intentsetData(PeopleCONTENT_URI);
startActivity(intent);12341234
/检查指定联系人
Uri personUri=ContentUriswithAppendedId(PeopleCONTENT_URI infoid);//infoid联系人ID
Intent intent=newIntent();
intentsetAction(IntentACTION_VIEW);
intentsetData(personUri);
startActivity(intent);1234512345
调用系统安装一个apk
Intent intent=newIntent();
intentsetDataAndType(Uriparse(file:///sdcard/newmopclientapk)"application/vndandroidpackage-archive");
startActivity(intent);123123
//调用相册
public static final String MIME_TYPE_IMAGE_JPEG = "image/";
public static final int ACTIVITY_GET_IMAGE = 0;
Intent getImage = new Intent(IntentACTION_GET_CONTENT);
getImageaddCategory(IntentCATEGORY_OPENABLE);
getImagesetType(MIME_TYPE_IMAGE_JPEG);
startActivityForResult(getImage ACTIVITY_GET_IMAGE);12345671234567
//调用系统相机应用程序,并存储拍下来的照片
Intent intent = new Intent(MediaStoreACTION_IMAGE_CAPTURE);
time = CalendargetInstance()getTimeInMillis();
intentputExtra(MediaStoreEXTRA_OUTPUT UrifromFile(new File(Environment
getExternalStorageDirectory()getAbsolutePath()+"/tucue" time + "jpg")));
startActivityForResult(intent ACTIVITY_GET_CAMERA_IMAGE);
@paramapkname apk名称
publicvoidsetupAPK(String apkname){
String fileName=EnvironmentgetExternalStorageDirectory()+"/"+apkname;
Intent intent=newIntent(IntentACTION_VIEW);
intentsetDataAndType(UrifromFile(newFile(fileName))"application/vndandroidpackage-archive");
mServicestartActivity(intent);
}1234567891011121312345678910111213
以上就是关于android怎么调用系统自带的图库打开指定目录的相册全部的内容,包括:android怎么调用系统自带的图库打开指定目录的相册、如何调用android的系统接口、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)