1 打开手机上的视频播放器播放视频
String url = "http://192.168.0.1/1.mp4" Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); String type = "video/*" Uri uri = Uri.parse(url); intent.setDataAndType(uri,type); startActivity(intent);
String url = "http://192.168.0.1/2.mp3" Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); String type = "audio/*" Uri uri = Uri.parse(url); intent.setDataAndType(uri,type); startActivity(intent);
File file = new File("SD/download/3.text"); Intent txtintent = new Intent("android.intent.action.VIEW"); txtintent.addCategory("android.intent.category.DEFAULT"); txtintent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Uri txturi = Uri.fromFile(file); txtintent.setDataAndType(txturi, "text/*"); startActivity(txtintent);
或者
File file = new File("SD/download/3.text") Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); String type = "text/*" Uri uri = Uri.fromFile(file); intent.setDataAndType(uri,type); startActivity(intent);
Uri uri = Uri.parse("market://details?id=" + getPakageName()); Intent intent = new Intent(Intent.ACTION_VIEW,uri); startActivity(intent);
后续再更新,觉得不错,顶一下哟