Android MediaScannerConnection - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android MediaScannerConnection class.

This code example shows how to use the following methods: connect
    private File mFile;
    private Context mContext;
 
    public MediaScannerNotifier(Context context, File file) {
        mFile = file;
        mConnection = new MediaScannerConnection(context, this);
        mConnection.connect();
        mContext = context;
 
    } 
 
    public void onMediaScannerConnected() { 
        mConnection.scanFile(mFile.getAbsolutePath(), null);
    } 
 
    public void onScanCompleted(String path, Uri uri) {
        try { 
            if (uri != null) {
                Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.setData(uri);
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: connect
    private MediaScannerConnection mConnection;
    private String mPath;
 
    private FFMpegMediaScannerNotifier(Context context, String path) {
        mPath = path;
        mConnection = new MediaScannerConnection(context, this);
        mConnection.connect();
    } 
     
    public static void scan(Context context, String path) {
    	new FFMpegMediaScannerNotifier(context, path);
    } 
 
    public void onMediaScannerConnected() { 
        mConnection.scanFile(mPath, null);
    } 
 
    public void onScanCompleted(String path, Uri uri) {
        mConnection.disconnect();
    } 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: isConnected, scanFile
		conn = new MediaScannerConnection(context, this);
		conn.connect();
	} 
 
	public void scanFile(String path, String mime) {
		if (conn.isConnected())
			conn.scanFile(path, mime);
		else { 
			filePath = path;
			mimeType = mime;
		} 
	} 
 
	public void onMediaScannerConnected() { 
		if (filePath != null)
			conn.scanFile(filePath, mimeType);
 
		filePath = null;
		mimeType = null;
	} 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: scanFile
            mPath = path;
        } 
 
        @Override 
        public void onMediaScannerConnected() { 
            mScannerConnection.scanFile(mPath, null);
        } 
 
        @Override 
        public void onScanCompleted(String path, Uri uri) {
            mScannerConnection.disconnect();
 
            // try to start an activity to view the file 
            Intent intent = new Intent(Intent.ACTION_VIEW, uri);
            try { 
                mContext.startActivity(intent);
            } catch (ActivityNotFoundException e) {
                Toast.makeText(mContext, R.string.start_activity_failed_message,
                        Toast.LENGTH_SHORT).show();
            } 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: connect
    private MediaScannerConnection mMs;
    private File mFile;
 
    public SingleMediaScanner(Context context, File f) {
        this.mFile = f;
        this.mMs = new MediaScannerConnection(context, this);
        this.mMs.connect();
    } 
 
    @Override 
    public void onMediaScannerConnected() { 
        this.mMs.scanFile(this.mFile.getAbsolutePath(), null);
    } 
 
    @Override 
    public void onScanCompleted(String path, Uri uri) {
        this.mMs.disconnect();
    } 
} 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android MediaScannerConnection Questions & Answers:

See Code Examples for Android MediaScannerConnection Methods: