@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTitle("本地视频"); setContentView(R.layout.local_video_main); mDbHelper = new DbHelper<VideoInfo>(); mVideoList = mDbHelper.queryForAll(VideoInfo.class); // 从数据库获取数据记录 mListView = (SlideListView) findViewById(R.id.my_listview); mFileAdapter = new FileAdapter(this); mListView.setAdapter(mFileAdapter); mListView.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // TODO Auto-generated method stub Intent intent = new Intent(LoaclVideoActivity.this, SubUnityPlayerActivity.class); // intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // intent.putExtra("oneshot", 0); // intent.putExtra("configchange", 0); // Uri uri = Uri.fromFile(new File(mVideoList.get(position).path)); // intent.setDataAndType(uri, "video/*"); intent.putExtra("url", "file://" + mVideoList.get(position).path); startActivity(intent); } }); vandaAlert = VandaAlert.createLoadingDialog(LoaclVideoActivity.this, "正在扫描..."); vandaAlert.setCanceledOnTouchOutside(false); }
/** 判断数据库是否存在该数据 */ private boolean isExists(VideoInfo videoInfo) { map.put("path", videoInfo.path); map.put("time", videoInfo.time); if (mDbHelper.exists(videoInfo, map)) { return true; } else { return false; } }