简体   繁体   中英

how to play video downloaded from server in SD-card

i have a file downloaded from server and save it in DOWNLOAD folder

how can i play it from default player of android with code ?

with actin code ? like this code

Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setDataAndType(Uri.fromFile(new File(Environment.getExternalStorageDirectory() + "/download/" + "tarsnak.3gp")), "application/vnd.android.package-archive");
            startActivity(intent);

You are setting the 'type' wrong. Use following code.

Intent i = new Intent(Intent.ACTION_VIEW);                      
i.setDataAndType(Uri.fromFile(new File(Environment.getExternalStorageDirectory() + "/download/" + "tarsnak.3gp")),"video/*");
startActivity(i); 

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