Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8844453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:29:28+00:00 2026-06-14T11:29:28+00:00

How can I display all images from a specific folder on android gallery like,

  • 0

How can I display all images from a specific folder on android gallery like, for example, whatapp does.
I`m using MediaScannerConnectionClient

File folder = new File("/sdcard/myfolder/");
allFiles = folder.list();
SCAN_PATH=Environment.getExternalStorageDirectory().toString()+"/myfolder/"+allFiles[0];
@Override
public void onScanCompleted(String path, Uri uri) {
    try {
        if (uri != null) {
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setData(uri);
            startActivity(intent);

        }
    } finally {
        conn.disconnect();
        conn = null;
    }
}

private void startScan() {
    if (conn != null) {
        conn.disconnect();
    }
    conn = new MediaScannerConnection(this, this);
    conn.connect();
}
    @Override
public void onMediaScannerConnected() {
    conn.scanFile(SCAN_PATH, "image/*");
}

But I`m getting a error at this point:

    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(uri);
    startActivity(intent);

Specific here:

startActivity(intent);

Fail to get type for: content://media/external/images/media/267830
No Activity found to handle Intent

On onScanCompleted my path and uri parameters are not null.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T11:29:29+00:00Added an answer on June 14, 2026 at 11:29 am

    Hi you can use the code below, i hope it helps you .

    package com.example.browsepicture;
    
    import java.io.File;
    
    import android.app.Activity;
    import android.content.Context;
    import android.content.Intent;
    import android.media.MediaScannerConnection;
    import android.media.MediaScannerConnection.MediaScannerConnectionClient;
    import android.net.Uri;
    import android.os.Bundle;
    import android.os.Environment;
    import android.view.View;
    import android.view.View.OnClickListener;
    import android.widget.Button;
    
    public class BrowsePicture2 extends Activity {
        String SCAN_PATH;
        File[] allFiles ;
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_browse_picture);
    
            File folder = new File(Environment.getExternalStorageDirectory().getPath()+"/aaaa/");
            allFiles = folder.listFiles();
    
            ((Button) findViewById(R.id.button1))
                    .setOnClickListener(new OnClickListener() {
                        public void onClick(View arg0) {
                            new SingleMediaScanner(BrowsePicture2.this, allFiles[0]);
                        }
                    });
        }
    
        public class SingleMediaScanner implements MediaScannerConnectionClient {
    
            private MediaScannerConnection mMs;
            private File mFile;
    
            public SingleMediaScanner(Context context, File f) {
                mFile = f;
                mMs = new MediaScannerConnection(context, this);
                mMs.connect();
            }
    
            public void onMediaScannerConnected() {
                mMs.scanFile(mFile.getAbsolutePath(), null);
            }
    
            public void onScanCompleted(String path, Uri uri) {
                Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.setData(uri);
                startActivity(intent);
                mMs.disconnect();
            }
    
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have to display auto-generated images from a folder in html. how can i
How can I set all images in one line and display only the first
I can display a simple Visual Basic inputbox from a PowerShell script like this:
I want to populate all the images from gallery to imagelist so that my
if I display one image link from a folder how can I use this
I am developing android application.In my application I want to display images from sd
Good day all, i have a load of images i want to display from
How i can display all applications icons and name which are installed in device
i'm working on a windows software which can display all the users, groups and
How can I display the content of all Views in a db in SQL

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.