Java Code Examples for android.media.MediaScannerConnection#connect()

The following examples show how to use android.media.MediaScannerConnection#connect() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RecorderVideoActivity.java    From FanXin-based-HuanXin with GNU General Public License v2.0 6 votes vote down vote up
public void sendVideo(View view) {
	if (TextUtils.isEmpty(localPath)) {
		EMLog.e("Recorder", "recorder fail please try again!");
		return;
	}

	msc = new MediaScannerConnection(this,
			new MediaScannerConnectionClient() {

				@Override
				public void onScanCompleted(String path, Uri uri) {
					System.out.println("scanner completed");
					msc.disconnect();
					setResult(RESULT_OK, getIntent().putExtra("uri", uri));
					finish();
				}

				@Override
				public void onMediaScannerConnected() {
					msc.scanFile(localPath, "video/*");
				}
			});
	msc.connect();

}
 
Example 2
Source File: PictureFragment.java    From JianDan_OkHttp with Apache License 2.0 5 votes vote down vote up
@Override
public void loadFinish(Object obj) {
    Bundle bundle = (Bundle) obj;
    boolean isSmallPic = bundle.getBoolean(DATA_IS_SIAMLL_PIC);
    String filePath = bundle.getString(DATA_FILE_PATH);
    File newFile = new File(filePath);
    JDMediaScannerConnectionClient connectionClient = new JDMediaScannerConnectionClient(isSmallPic,
            newFile);
    connection = new MediaScannerConnection(getActivity(), connectionClient);
    connectionClient.setMediaScannerConnection(connection);
    connection.connect();
}
 
Example 3
Source File: InformaCamMediaScanner.java    From CameraV with GNU General Public License v3.0 5 votes vote down vote up
public InformaCamMediaScanner(Context context, File f, OnMediaScannedListener listener) {
	this.f = f;
	this.context = context;
	
	mListener = listener;
	msc = new MediaScannerConnection(this.context, this);
	msc.connect();
}
 
Example 4
Source File: ImageDetailActivity.java    From JianDan_OkHttp with Apache License 2.0 5 votes vote down vote up
@Override
public void loadFinish(Object obj) {
    //下载完图片后,通知更新
    Bundle bundle = (Bundle) obj;
    boolean isSmallPic = bundle.getBoolean(DATA_IS_SIAMLL_PIC);
    String filePath = bundle.getString(DATA_FILE_PATH);
    File newFile = new File(filePath);
    JDMediaScannerConnectionClient connectionClient = new JDMediaScannerConnectionClient(isSmallPic,
            newFile);
    connection = new MediaScannerConnection(this, connectionClient);
    connectionClient.setMediaScannerConnection(connection);
    connection.connect();
}
 
Example 5
Source File: ImageDetailActivity.java    From JianDan with Apache License 2.0 5 votes vote down vote up
@Override
public void loadFinish(Object obj) {
    //下载完图片后,通知更新
    Bundle bundle = (Bundle) obj;
    boolean isSmallPic = bundle.getBoolean(DATA_IS_SIAMLL_PIC);
    String filePath = bundle.getString(DATA_FILE_PATH);
    File newFile = new File(filePath);
    JDMediaScannerConnectionClient connectionClient = new JDMediaScannerConnectionClient(isSmallPic,
            newFile);
    connection = new MediaScannerConnection(this, connectionClient);
    connectionClient.setMediaScannerConnection(connection);
    connection.connect();
}
 
Example 6
Source File: PictureFragment.java    From JianDan with Apache License 2.0 5 votes vote down vote up
@Override
public void loadFinish(Object obj) {
    Bundle bundle = (Bundle) obj;
    boolean isSmallPic = bundle.getBoolean(DATA_IS_SIAMLL_PIC);
    String filePath = bundle.getString(DATA_FILE_PATH);
    File newFile = new File(filePath);
    JDMediaScannerConnectionClient connectionClient = new JDMediaScannerConnectionClient(isSmallPic,
            newFile);
    connection = new MediaScannerConnection(getActivity(), connectionClient);
    connectionClient.setMediaScannerConnection(connection);
    connection.connect();
}
 
Example 7
Source File: ImageDetailActivity.java    From JianDan_OkHttpWithVolley with Apache License 2.0 5 votes vote down vote up
@Override
public void loadFinish(Object obj) {
    //下载完图片后,通知更新
    Bundle bundle = (Bundle) obj;
    boolean isSmallPic = bundle.getBoolean(DATA_IS_SIAMLL_PIC);
    String filePath = bundle.getString(DATA_FILE_PATH);
    File newFile = new File(filePath);
    JDMediaScannerConnectionClient connectionClient = new JDMediaScannerConnectionClient(isSmallPic,
            newFile);
    connection = new MediaScannerConnection(this, connectionClient);
    connectionClient.setMediaScannerConnection(connection);
    connection.connect();
}
 
Example 8
Source File: PictureFragment.java    From JianDan_OkHttpWithVolley with Apache License 2.0 5 votes vote down vote up
@Override
public void loadFinish(Object obj) {
    Bundle bundle = (Bundle) obj;
    boolean isSmallPic = bundle.getBoolean(DATA_IS_SIAMLL_PIC);
    String filePath = bundle.getString(DATA_FILE_PATH);
    File newFile = new File(filePath);
    JDMediaScannerConnectionClient connectionClient = new JDMediaScannerConnectionClient(isSmallPic,
            newFile);
    connection = new MediaScannerConnection(getActivity(), connectionClient);
    connectionClient.setMediaScannerConnection(connection);
    connection.connect();
}
 
Example 9
Source File: MyImageFileUtils.java    From FaceDetect with Apache License 2.0 5 votes vote down vote up
/**
 * 保存后用MediaScanner扫描,通用的方法
 *
 */
public static void saveImageSendScanner (Activity activity,   MyMediaScannerConnectionClient scannerClient) {

    final MediaScannerConnection scanner = new MediaScannerConnection(activity, scannerClient);
    scannerClient.setScanner(scanner);
    scanner.connect();
}
 
Example 10
Source File: MediaStoreUtils.java    From BigApp_WordPress_Android with Apache License 2.0 4 votes vote down vote up
public static void addImage2Gallery(Context context,
		BaseMediaScannerListener l) {
	l.setMimeType("image/jpg");
	mConnection = new MediaScannerConnection(context, l);
	mConnection.connect();
}
 
Example 11
Source File: MediaStoreUtils.java    From BigApp_WordPress_Android with Apache License 2.0 4 votes vote down vote up
public static void addVideo2Gallery(Context context,
		BaseMediaScannerListener l) {
	l.setMimeType("video/mp4");
	mConnection = new MediaScannerConnection(context, l);
	mConnection.connect();
}
 
Example 12
Source File: MediaShootActivity.java    From BigApp_WordPress_Android with Apache License 2.0 4 votes vote down vote up
public void sendMedia() {
	mConnection = new MediaScannerConnection(this, this);
	mConnection.connect();
}
 
Example 13
Source File: ShareUtil.java    From nono-android with GNU General Public License v3.0 4 votes vote down vote up
public SingleMediaScanner(Context context, File f) {
    mFile = f;
    mMs = new MediaScannerConnection(context, this);
    mMs.connect();
}
 
Example 14
Source File: MediaScanner.java    From Chimee with MIT License 4 votes vote down vote up
MediaScanner(Context context, File f) {
    mFile = f;
    mMs = new MediaScannerConnection(context, this);
    mMs.connect();
}
 
Example 15
Source File: DeleteFileJob.java    From secrecy with Apache License 2.0 4 votes vote down vote up
public SingleMediaScanner(Context context, java.io.File f) {
    mFile = f;
    mMs = new MediaScannerConnection(context, this);
    mMs.connect();
}
 
Example 16
Source File: Utbil.java    From stynico with MIT License 4 votes vote down vote up
public MediaScannerNotifier(Context context, String path) {
    this.path = path;
    connection = new MediaScannerConnection(context, this);
    connection.connect();
}
 
Example 17
Source File: Utll.java    From stynico with MIT License 4 votes vote down vote up
public MediaScannerNotifier(Context context, String path) {
    this.path = path;
    connection = new MediaScannerConnection(context, this);
    connection.connect();
}
 
Example 18
Source File: Signature.java    From SignatureView with Apache License 2.0 4 votes vote down vote up
MyMediaScanner(Context context, File file) {
    this.file = file;
    mSC = new MediaScannerConnection(context, this);
    mSC.connect();
}
 
Example 19
Source File: Utbil.java    From styT with Apache License 2.0 4 votes vote down vote up
public MediaScannerNotifier(Context context, String path) {
    this.path = path;
    connection = new MediaScannerConnection(context, this);
    connection.connect();
}
 
Example 20
Source File: Utll.java    From styT with Apache License 2.0 4 votes vote down vote up
public MediaScannerNotifier(Context context, String path) {
    this.path = path;
    connection = new MediaScannerConnection(context, this);
    connection.connect();
}