Я не могу воспроизвести видеофайл с SD-карты.- Я играю определенный видео файл с SD-карты.- при выборе видео из списка оно не будет воспроизводиться.-что я передаю намерение, чтобы класс VideoView не читал.
public class AndroidThumbnailList extends ListActivity{
String[] videoFileList = {
"/sdcard/Periodontal/Perio-Probling.mp4",
"/sdcard/Periodontal/Inlays.mp4"
/* "/sdcard/Video/Onlays.mp4",
"/sdcard/Video/Root Canal Treatment.mp4",
"/sdcard/Video/crown4.mp4",
"/sdcard/Video/crown5.mp4",
"/sdcard/Video/crown6.mp4",
"/sdcard/Video/crown7.mp4"*/
};
public class MyThumbnaildapter extends ArrayAdapter<String>{
public MyThumbnaildapter(Context context, int textViewResourceId,
String[] objects) {
super(context, textViewResourceId, objects);
// TODO Auto-generated constructor stub
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
View row = convertView;
if(row==null){
LayoutInflater inflater=getLayoutInflater();
row=inflater.inflate(R.layout.row, parent, false);
}
row.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
if(position==0)
{
Intent intent = new Intent(AndroidThumbnailList.this, ViewVideo.class);
intent.putExtra("videofilename", videoFileList);
startActivity(intent);
}
/*if(position==1)
{
Intent intent = new Intent(mContext, PeriodontalCare.class);
mContext.startActivity(intent);
}
if(position==2)
{
Intent i = new Intent(mContext, CosmeticCare.class);
mContext.startActivity(i);
}*/
}
});
TextView textfilePath = (TextView)row.findViewById(R.id.FilePath);
textfilePath.setText(videoFileList[position]);
ImageView imageThumbnail = (ImageView)row.findViewById(R.id.Thumbnail);
Bitmap bmThumbnail;
bmThumbnail = ThumbnailUtils.createVideoThumbnail(videoFileList[position], Thumbnails.MICRO_KIND);
imageThumbnail.setImageBitmap(bmThumbnail);
return row;
}
}
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setListAdapter(new MyThumbnaildapter(AndroidThumbnailList.this, R.layout.row, videoFileList));
}
}
Мой класс VideoView:
public class ViewVideo extends Activity {
private String videoFileList;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.videofile);
// mVideoView = (VideoView) findViewById(R.id.surface_view);
System.gc();
Intent i = getIntent();
Bundle extras = i.getExtras();
videoFileList = extras.getString("videofilename");
VideoView vv = new VideoView(getApplicationContext());
setContentView(vv);
vv.setVideoPath(videoFileList);
vv.setMediaController(new MediaController(this));
vv.requestFocus();
vv.start();
}
}