简体   繁体   中英

How to open folder which I have created in my app in Android programmatically?

I am making one app to add watermark to video using FFMPEG library.and I have create one directory /sdcard/Pictures/Video Stamper/ to store output video with watermark.

now in mp app I have made one button called Output Folder when user click that button then it will automatically browse user to my output video directory which I have created previously( /sdcard/Pictures/Video Stamper/ ).

You can try below code for that

public void openFolder(){
     Uri selectedUri = Uri.parse(Environment.getExternalStorageDirectory() + "/myFolder/");
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setDataAndType(selectedUri, "*/*");

    if (intent.resolveActivityInfo(getPackageManager(), 0) != null)
    {
        startActivity(intent);
    }
    else
    {
        // if you reach this place, it means there is no any file 
       } 
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM