I am trying to put selected files(not exclusive to images, it can be any file) from file chooser intent to a zip file. I need full file path to do this, but intent only gives uri paths.
- I have tried .getPath() but that does not give the real path of the file
- I have tried getRealPathFromRealURI: android get real path by Uri.getPath()
- I have tried File file = new File(), file.getPath()
This is my code:
    public void onActivityResult(int requestCode, int resultCode, Intent result){
        if(requestCode == 111) {
            if(null != result) { // checking empty selection
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
                    if(null != result.getClipData()) { // checking multiple selection or not
                        for(int i = 0; i < result.getClipData().getItemCount(); i++) {
                            String uri = result.getClipData().getItemAt(i).getUri().getPath();
                            uriList.add(uri);
                            Log.d("PATH: ",uri);
                        }
                        confirmationDialog();
                    } else {
                        String uri = result.getData().getPath();
                        uriList.add(uri);
                        Log.d("PATH: ",uri);
                        confirmationDialog();
                    }
                }else{Toast.makeText(getApplicationContext(),
                        "An error has occured: API level requirements not met",Toast.LENGTH_SHORT).show();};
            }
        }
    }
It should give the real path for example: "/sdcard/filename.example"
Instead, it gives me: "/document/9016-4ef8:filename.example"
 
     
     
    