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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:24:15+00:00 2026-06-11T22:24:15+00:00

How to get multiple images to show up in this coverflow. I am getting

  • 0

How to get multiple images to show up in this coverflow. I am getting null pointer exception and other problems. How to be able to load the images from the SD card, not knowing how many images are on the SD card? The number of images is not fixed. I was able to get one image to show up with no problems by using this code:

i.setImageBitmap(BitmapFactory.decodeFile("/mnt/sdcard/pic03.png"));

it loaded one image, the one specified from the SD card and made all the coverflow images as that one same image, pic03.png, about a dozen of the same one image filled the cover flow. that is great, however i wanted to load all of the images on the SD card. so each image fills each part of the coverflow, not one same image filling all of them.

totally lost here and tried to do this and got null pointer exception from the Logcat and wonder why? does anyone know how to get this to work?

here below is the code that i am working with to give you some idea:
notice that it does work when loading one image from a specified address on the SD card. at least that part worked great, but multiple images?

// added this code inside the onCreate method to load the cursor with images only if the IS_PRIVATE column
// in the sqlite database is equal to the integer 1 

String[] img = { MediaStore.Images.Media._ID };
imagecursor = managedQuery(
MediaStore.Images.Media.EXTERNAL_CONTENT_URI, img,
MediaStore.Images.Media.IS_PRIVATE + "='" + 1 +"'",null, MediaStore.Images.Media._ID + "");
image_column_index = imagecursor.getColumnIndexOrThrow(MediaStore.Images.Media._ID);
count = imagecursor.getCount();

//-------------------------------------------------------------------
// ImageAdapter class is a nested class inside of the CoverFlowExample class

public class ImageAdapter extends BaseAdapter {
int mGalleryItemBackground;
private Context mContext;
private FileInputStream fis;

// originally earlier version of this app loaded images from the R.drawable folder like this

private Integer[] mImageIds = {

  //  R.drawable.pic01,
  //  R.drawable.pic02,
  //  R.drawable.pic03,
  //  R.drawable.pic04,
  //  R.drawable.pic05,
  //  R.drawable.pic06,
  //  R.drawable.pic07,
  //  R.drawable.pic08,
  //  R.drawable.pic09
};

//---------------------------------------------------------------------
// getView() method that is in the ImageAdapter class that extends the BaseAdapter class
// this class is a nested class inside the CoverFlowExample class that extends Activity.
// the CoverFlowExample class is used to implement the coverflow part of the app as an Activity

public View getView(int position, View convertView, ViewGroup parent) {
  // to load from resources like SD card
  ImageView i = new ImageView(mContext);

 // use for single image -->  i.setImageBitmap(BitmapFactory.decodeFile("/mnt/sdcard/pic03.png"));

 image_column_index = imagecursor.getColumnIndexOrThrowMediaStore.Images.Media.DATA);
 imagecursor.moveToPosition(position);

 int id = imagecursor.getInt(image_column_index);
 i.setImageURIUri.withAppendedPathMediaStore         .Images.Media.EXTERNAL_CONTENT_URI, ""+ id));

 // image from R.drawable use -->  i.setImageResource(mImageIds[position]);
 i.setLayoutParams(new CoverFlow.LayoutParams(130, 130));
 i.setScaleType(ImageView.ScaleType.MATRIX);            
 return i;

  // return mImages[position];  <-- not using this as im am not getting image from R.drawable
}
  • 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-11T22:24:16+00:00Added an answer on June 11, 2026 at 10:24 pm

    The problem seems that String[] img = { MediaStore.Images.Media._ID }
    this is the only column contained in the imagecursor, while you try to get the DATA column ,imagecursor.getColumnIndexOrThrowMediaStore.Images.Media.DATA)

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

Sidebar

Related Questions

I'm parsing XML to get multiple markers directly from the database, so used the
Is there a better way to get multiple top X results from a MySQL
When running this powershell command Get-ChildItem -Recurse -Include *.txt You get multiple tables in
I'm wondering if anybody knows how to get multiple counts from a single query
I am trying to get a list of products and images from two tables.
I am currently trying to get multiple xml files into my xsl file to
I'm using Charles Campbell's MPage[0] plugin to get multiple pages open, so I have
I have a question about the JFileChooser in Swing. I'm trying to get multiple
In short: How do I access LocationManagerService.mProximityAlerts ? I'm trying to get multiple ProximityAlerts
I am trying to get a multiple upload library working for my Codeigniter based

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.