0
txt_pathShow = (TextView) findViewById(R.id.txt_path);
    btn_video = (Button) findViewById(R.id.btn_video);

    btn_video.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            myFileIntent = new Intent(Intent.ACTION_GET_CONTENT);
            myFileIntent.setType("video/*");
            startActivityForResult(myFileIntent, 10);
        }
    });


}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    switch (requestCode){

        case 10:
            if (resultCode==RESULT_OK){
                String path = data.getData().getPath();
                txt_pathShow.setText(path);
            }
            break;

    }

}

Currently it recovers the route in this format: documents/images/image:62. but I would like it to recover me in this other way: /documentos/images/foto.jpg

Anonimo23
  • 1
  • 3
  • There is no "real path", as the user does not have to choose a file on the device, let alone a file that your app has access to via the filesystem. Please use the `Uri`, such as via `openInputStream()` on a `ContentResolver`. – CommonsWare Dec 01 '20 at 16:43
  • How I would have to use Uri, you could be more specific or with an example. – Anonimo23 Dec 01 '20 at 16:53
  • You would need to tell us what you plan on doing with the content. You are requesting some video content via `ACTION_GET_CONTENT`. What do you plan to do with that content, once you get it? – CommonsWare Dec 01 '20 at 17:30
  • what I intend to do is open the file manager and select a file (video), and go back to the app and retrieve the path of the file that you select. is in the code above. but the problem is that it retrieves a path from the content (content: //com.android.providers.downloads.documents/document/2) what I want is a type like this: (dowloads / documents / video.mp4) – Anonimo23 Dec 01 '20 at 18:17

0 Answers0