[英]open file from external storage
我正在尝试使用 Intent 来打开外部存储中的文件,但我不知道为什么它会显示 toast could not find item !
我也在不同的文件上尝试过,但它的作用相同,我在清单中使用的权限
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
File temp = new File(address,mylist.get(position));
if (temp.isFile()){
//Toast.makeText(getApplicationContext(),"This is File !!",Toast.LENGTH_SHORT).show();
String sfile = temp.getPath();
Uri uri = Uri.parse(sfile);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setType("image/*");
intent.putExtra(Intent.ACTION_VIEW,uri);
startActivity(Intent.createChooser(intent,"Open file"));
}else {
ref(address+"/"+mylist.get(position).toString());
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.