Code example for MediaScannerConnection

Methods: isConnected, scanFile

0
	public void onMediaScannerConnected() { 
		// TODO Auto-generated method stub 
		String path = "file://" + Environment.getExternalStorageDirectory();
		Log.i("ImageMediaScannerConnectionClient", path);
 
		if (mConnect.isConnected()) {
			mConnect.scanFile(path, "image/jpeg");
		} 
	} 
 
	@Override 
	public void onScanCompleted(String path, Uri uri) {
		Log.i("ImageMediaScannerConnectionClient", path + "   " + uri.toString());
		mConnect.disconnect();
		FolderActivity.coverList = MediaStoreUtil.queryCoverInfo(context,
				MediaStore.Images.Media.EXTERNAL_CONTENT_URI, MediaStoreUtil.COVER_INFO, null,
				null, null); 
		progress.dismiss();
 
	}