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 7090081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:00:04+00:00 2026-05-28T08:00:04+00:00

I’m trying to load images from the specific folder in sd card.i saved images

  • 0

I’m trying to load images from the specific folder in sd card.i saved images to folder in the sd card. now i want to load images from that folder.try to do this using online tutorials. but didn’t work any thing.when i try to use below code i received blank screen.
What am I doing wrong? Many thanks for any help.

public class F6Activity extends softActivity
{
private Cursor cursor;
private int columnIndex;
Button next;


protected void onCreate(Bundle savedInstanceState) 
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_f6);


Gallery g = (Gallery) findViewById(R.id.gallery);
//request only the image ID to be returned
String[] projection = {MediaStore.Images.Media._ID};
//Create the cursor pointing to the SDCard
 cursor = managedQuery( MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
  projection, 
  MediaStore.Images.Media.DATA + " like ? ",
  new String[] {"%ereports%"},  
  null);
  //Get the column index of the image ID
  columnIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.Media._ID);
  g.setAdapter(new ImageAdapter(this));



  }


 private class ImageAdapter extends BaseAdapter {

 private Context context;

 public ImageAdapter(Context localContext) 
 {
  context = localContext;
 }

 public int getCount() 
 {
  return cursor.getCount();
 }
 public Object getItem(int position) 
 {
  return position;
 }
public long getItemId(int position) {
  return position;
 }

 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
 ImageView i = new ImageView(context);
 // Move cursor to current position
 cursor.moveToPosition(position);
 // Get the current value for the requested column
 int imageID = cursor.getInt(columnIndex);
 // obtain the image URI
 Uri uri = Uri.withAppendedPath( MediaStore.Images.Media.EXTERNAL_CONTENT_URI,      
 Integer.toString(imageID) );
 String url = uri.toString();
 // Set the content of the image based on the image URI
 int originalImageId = Integer.parseInt(url.substring(url.lastIndexOf("/") + 1, 
 url.length()));
 Bitmap b = MediaStore.Images.Thumbnails.getThumbnail(getContentResolver(),
                originalImageId, MediaStore.Images.Thumbnails.MINI_KIND, null);
 i.setImageBitmap(b);
 i.setLayoutParams(new Gallery.LayoutParams(150, 100));
 i.setScaleType(ImageView.ScaleType.FIT_XY);
 int mGalleryItemBackground = 0;
i.setBackgroundResource(mGalleryItemBackground);

 return i;
 }
 }




 }
  • 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-05-28T08:00:05+00:00Added an answer on May 28, 2026 at 8:00 am

    I am getting confused with code, Now I can’t say the problem in your code, it will take time for me. I suggest to use the code available at below link. It is working fine. I will try to find the problem in your code afterwards. Now check the link below.

    Display images from SD card

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is

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.