[英]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.