Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("file/*");
intent.setType("image/*");
intent.setType("video/*");
// intent.addCategory(Intent.CATEGORY_OPENABLE);
startActivityForResult(intent, READ_REQUEST_CODE)
if (requestCode == READ_REQUEST_CODE && resultCode == Activity.RESULT_OK) {
// The document selected by the user won't be returned in the intent.
// Instead, a URI to that document will be contained in the return intent
// provided to this method as a parameter.
// Pull that URI using resultData.getData().
Uri uri = null;
if (resultData != null) {
uri = resultData.getData();
uri1 = uri;
Log.i("anderwidth", "Uri: " + uri.toString());
File file = new File(uri1.getPath());
}
}
を読み取ろうとするとき、私はアンドロイドとの換装を使用していませ。何が起こっている?私はfile.existsは私が誰かがファイルマネージャアプリをダウンロードした場合、それがダウンロードされていないいない場合は、動作します// ...
その内容をfalse.Everytime与える、ファイルなどの画像や動画を読み込むために取得することはできません。
'ファイルファイル=新しいファイル(uri1.getPath());'。それは動作しません。 uri1.getPath()とuri2.toStringの完全な値を投稿してください()。 – greenapps