Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show converted file in activity

Tags:

java

android

I'm developing a video converter in android studio. I'm able to convert file successfully and can play the resulting file with:

File file = new File(filepath);
Uri path = Uri.fromFile(file);
Intent Openintent = new Intent(Intent.ACTION_VIEW);
Openintent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Openintent.setDataAndType(path, "audio/mp3");
try {
    startActivity(Openintent);
}
catch (ActivityNotFoundException e) {

}

But I can't find any code to open the resulting folder and show converted file marked. Like we have in windows Locate file in folder.

like image 269
m.qayyum Avatar asked Dec 31 '18 08:12

m.qayyum


1 Answers

here is how you can open the containing folder for the converted file

String folderPath = filepath.substring(0 , filepath.lastIndexOf('/') + 1);
Uri uri = Uri.parse(folderPath);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(uri, "resource/folder");
startActivity(intent); 
like image 93
Ali Faris Avatar answered Sep 30 '22 04:09

Ali Faris