Android: How can i play Video in the internal MediaPlayer from a Resource, Can anyone Help?
        Posted  
        
            by 
                Lucy
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Lucy
        
        
        
        Published on 2011-01-09T12:41:38Z
        Indexed on 
            2011/01/09
            12:53 UTC
        
        
        Read the original article
        Hit count: 610
        
Hi,
I am trying to play a mp4 video from the resource within the app, either res/raw or assets, but i am having no luck, nor can i find any tutorials or solutions that work anywhere, hoping someone hear can provide the answer.
Code below that i thought would work but doesnt, please show me how?
Thanks Lucy
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.video);    
    final Button button = (Button) findViewById(R.id.play);  
         button.setOnClickListener(new Button.OnClickListener() {  
             public void onClick(View v) {  
                 Uri uri = Uri.parse("android.resource://com.video.play.test/" + R.raw.test2);
                 Intent intent=new Intent(Intent.ACTION_VIEW); intent.setDataAndType(uri, "video/mp4");
                 startActivity(intent);  
             }
         });  
}
        © Stack Overflow or respective owner