我正在尝试将文件路径加载到字符串数组(路径)中,但我被卡住了。这是我的代码:
public class MainActivity extends ListActivity{
String path = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Video/";
String[] videoFileList = {
path,
};
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(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);
}
ImageView imageThumbnail = (ImageView)row.findViewById(R.id.Thumbnail);
Bitmap bmThumbnail;
bmThumbnail = ThumbnailUtils.createVideoThumbnail(videoFileList[position], Thumbnails.MINI_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(MainActivity.this, R.layout.row, videoFileList));
}
}
我正在尝试加载视频路径。我可以加载一个特定的文件,但不能加载目录中的所有文件。任何帮助将不胜感激。谢谢!