Launch ACTION_VIEW Intent to play mp4

Work on the exercise "Display Video thumbnail in ListView", override the method onListItemClick() to Launch ACTION_VIEW Intent to play the mp4 of the clicked item.

We can use the code below to play the Uri of "video/mp4" by launching ACTION_VIEW Intent.

Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(intentUri, "video/mp4");
startActivity(intent);


 @Override
protected void onListItemClick(ListView l, View v,
int position, long id) {
// TODO Auto-generated method stub
//super.onListItemClick(l, v, position, id);

String uriString = l.getItemAtPosition(position).toString();
Uri intentUri = Uri.parse(uriString);

Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(intentUri, "video/mp4");
startActivity(intent);

}


Download the files.