当前位置: 首页>>代码示例>>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;未经允许,请勿转载。