當前位置: 首頁>>代碼示例>>Java>>正文


Java MediaScannerConnection.connect方法代碼示例

本文整理匯總了Java中android.media.MediaScannerConnection.connect方法的典型用法代碼示例。如果您正苦於以下問題:Java MediaScannerConnection.connect方法的具體用法?Java MediaScannerConnection.connect怎麽用?Java MediaScannerConnection.connect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.media.MediaScannerConnection的用法示例。


在下文中一共展示了MediaScannerConnection.connect方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: scanFile

import android.media.MediaScannerConnection; //導入方法依賴的package包/類
/**
 * 掃描指定的文件
 *
 * @param context
 * @param filePath
 * @param sListener
 */
public static MediaScannerConnection scanFile(Context context, String[] filePath, String[] mineType,
                                              MediaScannerConnection.OnScanCompletedListener sListener) {

    ClientProxy client = new ClientProxy(filePath, mineType, sListener);

    try {
        MediaScannerConnection connection = new MediaScannerConnection(
                context.getApplicationContext(), client);
        client.mConnection = connection;
        connection.connect();
        return connection;
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
 
開發者ID:ceji-longquan,項目名稱:ceji_android,代碼行數:24,代碼來源:MediaScannerFile.java

示例2: sendVideo

import android.media.MediaScannerConnection; //導入方法依賴的package包/類
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) {
					Log.d("log scanner completed");
					msc.disconnect();
					setResult(RESULT_OK, getIntent().putExtra("uri", uri));
					finish();
				}

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

}
 
開發者ID:macyuan,項目名稱:TAG,代碼行數:26,代碼來源:RecorderVideoActivity.java

示例3: onCreate

import android.media.MediaScannerConnection; //導入方法依賴的package包/類
@Override
public void onCreate()
{
	super.onCreate();

	if (!mCommunicationServer.start() || !mSeamlessServer.start())
		stopSelf();

	mNotificationUtils = new NotificationUtils(this);
	mDatabase = new AccessDatabase(this);
	mMediaScanner = new MediaScannerConnection(this, null);
	mHotspotUtils = HotspotUtils.getInstance(this);
	mWifiLock = ((WifiManager) getApplicationContext().getSystemService(Service.WIFI_SERVICE))
			.createWifiLock(TAG);

	mReceive.setNotifyDelay(2000);
	mSend.setNotifyDelay(2000);

	mMediaScanner.connect();

	getWifiLock().acquire();
	updateServiceState(getNotificationUtils().getPreferences().getBoolean("trust_always", false));
}
 
開發者ID:genonbeta,項目名稱:TrebleShot,代碼行數:24,代碼來源:CommunicationService.java

示例4: connectMediaScan

import android.media.MediaScannerConnection; //導入方法依賴的package包/類
private void connectMediaScan(final String filename) {
    msc = new MediaScannerConnection(this, new MediaScannerConnectionClient() {

        @Override
        public void onScanCompleted(String path, Uri uri) {
            savedUri = uri;
            msc.disconnect();
            if (isNeedShare) {
                KakaoShare.shareImageKakao(MainImageActivity.this, uri);
            }
            isNeedShare = false;
        }

        @Override
        public void onMediaScannerConnected() {
            msc.scanFile(filename, "image/png");
        }
    });
    msc.connect();
}
 
開發者ID:g82,項目名稱:open-mygirl-android-gradle,代碼行數:21,代碼來源:MainImageActivity.java

示例5: SimpleMediaScannerConnction

import android.media.MediaScannerConnection; //導入方法依賴的package包/類
public SimpleMediaScannerConnction(final Context context, final File f) {
    fileToScan = f;
    mediaScannerConnection = new MediaScannerConnection(context, this);
    try {
        mediaScannerConnection.connect();
    } catch (final Exception e) {
        e.printStackTrace();
    }
}
 
開發者ID:MimiReader,項目名稱:mimi-reader,代碼行數:10,代碼來源:SimpleMediaScannerConnction.java

示例6: saveImageSendScanner

import android.media.MediaScannerConnection; //導入方法依賴的package包/類
/**
 * 保存後用MediaScanner掃描,通用的方法
 *
 */
private static void saveImageSendScanner (Context context,   MyMediaScannerConnectionClient scannerClient) {

    final MediaScannerConnection scanner = new MediaScannerConnection(context, scannerClient);
    scannerClient.setScanner(scanner);
    scanner.connect();
}
 
開發者ID:hss01248,項目名稱:HttpUtilForAndroid,代碼行數:11,代碼來源:DownFileHandlerUtil.java

示例7: onActivityCreated

import android.media.MediaScannerConnection; //導入方法依賴的package包/類
@Override
public void onActivityCreated(Bundle savedInstanceState)
{
	super.onActivityCreated(savedInstanceState);

	mMediaScanner = new MediaScannerConnection(getActivity(), null);

	mMediaScanner.connect();
	mIntentFilter.addAction(ACTION_FILE_LIST_CHANGED);

	if (getAdapter().getPath() == null)
		goPath(FileUtils.getApplicationDirectory(getActivity()));
}
 
開發者ID:genonbeta,項目名稱:TrebleShot,代碼行數:14,代碼來源:FileListFragment.java

示例8: saveImageSendScanner

import android.media.MediaScannerConnection; //導入方法依賴的package包/類
/**
 * 保存後用MediaScanner掃描,通用的方法
 *
 */
public static void saveImageSendScanner (Activity activity,   MyMediaScannerConnectionClient scannerClient) {

    final MediaScannerConnection scanner = new MediaScannerConnection(activity, scannerClient);
    scannerClient.setScanner(scanner);
    scanner.connect();
}
 
開發者ID:hss01248,項目名稱:FaceDetect,代碼行數:11,代碼來源:MyImageFileUtils.java

示例9: connectMediaScan

import android.media.MediaScannerConnection; //導入方法依賴的package包/類
private void connectMediaScan(final String filename) {
    msc = new MediaScannerConnection(mActivity, new MediaScannerConnection.MediaScannerConnectionClient() {

        @Override
        public void onScanCompleted(String path, Uri uri) {
            msc.disconnect();
        }

        @Override
        public void onMediaScannerConnected() {
            msc.scanFile(filename, "image/png");
        }
    });
    msc.connect();
}
 
開發者ID:g82,項目名稱:open-mygirl-android-gradle,代碼行數:16,代碼來源:ImageSaveTask.java

示例10: loadFinish

import android.media.MediaScannerConnection; //導入方法依賴的package包/類
@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();
}
 
開發者ID:ZhaoKaiQiang,項目名稱:JianDan_OkHttpWithVolley,代碼行數:13,代碼來源:PictureFragment.java

示例11: loadFinish

import android.media.MediaScannerConnection; //導入方法依賴的package包/類
@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();
}
 
開發者ID:ZhaoKaiQiang,項目名稱:JianDan_OkHttpWithVolley,代碼行數:14,代碼來源:ImageDetailActivity.java

示例12: MediaScannerNotifier

import android.media.MediaScannerConnection; //導入方法依賴的package包/類
public MediaScannerNotifier(Context context, File file) {
    mFile = file;
    mConnection = new MediaScannerConnection(context, this);
    mConnection.connect();
    mContext = context;

}
 
開發者ID:daxslab,項目名稱:daxSmail,代碼行數:8,代碼來源:MediaScannerNotifier.java

示例13: scanPhoto

import android.media.MediaScannerConnection; //導入方法依賴的package包/類
public static void scanPhoto(final String imageFileName) {

        msConn = new MediaScannerConnection(MyApplication.getInstance(), new MediaScannerConnection.MediaScannerConnectionClient() {
            public void onMediaScannerConnected() {
                msConn.scanFile(imageFileName, null);
                Log.i("msClient objy", "connection established");
            }

            public void onScanCompleted(String path, Uri uri) {
                msConn.disconnect();
                Log.i("msClient Utility", "scan completed");
            }
        });
        msConn.connect();
    }
 
開發者ID:birdcopy,項目名稱:Android-Birdcopy-Application,代碼行數:16,代碼來源:FlyingFileManager.java

示例14: loadPictureIntoGalleryApp

import android.media.MediaScannerConnection; //導入方法依賴的package包/類
private void loadPictureIntoGalleryApp(final String filename) {
    MoPubMediaScannerConnectionClient mediaScannerConnectionClient =
            new MoPubMediaScannerConnectionClient(filename, null);
    final MediaScannerConnection mediaScannerConnection =
            new MediaScannerConnection(mContext, mediaScannerConnectionClient);
    mediaScannerConnectionClient.setMediaScannerConnection(mediaScannerConnection);
    mediaScannerConnection.connect();
}
 
開發者ID:JSafaiyeh,項目名稱:Fabric-Example-App-Android,代碼行數:9,代碼來源:MraidNativeCommandHandler.java

示例15: MediaScannerNotifier

import android.media.MediaScannerConnection; //導入方法依賴的package包/類
public MediaScannerNotifier(Context context, String path) {
    this.path = path;
    connection = new MediaScannerConnection(context, this);
    connection.connect();
}
 
開發者ID:stytooldex,項目名稱:stynico,代碼行數:6,代碼來源:Utll.java


注:本文中的android.media.MediaScannerConnection.connect方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。