Click here to Skip to main content
15,887,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have 2gb of videos in memory card .mp4 format , i want to play video from memory card in android App.
I have trying some code.. but its working on only micro-max A2900 Device..


Intent intent = new Intent(Intent.ACTION_VIEW);
File sdCard = Environment.getExternalStorageDirectory();
File file = new File(sdCard, "/readvideo/faithclassvideo1.mp4");
intent.setDataAndType(Uri.fromFile(file), "video/*");
startActivity(intent);
Posted
Comments
CHill60 21-Apr-15 6:57am    
Please don't repost! If you have anything to add to your original post then use the Improve question link

1 solution

Try this:
String baseDir = Environment.getExternalStorageDirectory().getAbsolutePath();
String fileName =  "/readvideo/faithclassvideo1.mp4";
File f = new File(baseDir + File.separator + fileName);


Don't forget:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />


Good luck!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900