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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:31:07+00:00 2026-05-28T03:31:07+00:00

hi I’ve could use a little help understanding the imageadapter extending the baseadapter. I’m

  • 0

hi I’ve could use a little help understanding the imageadapter extending the baseadapter. I’m on the homestretch of the app I’ve been working on for the last month and am stumped. A little about my project. It keeps track of vehicles. For any vehicle the user can take as many photos with the camera as they would like. This part works. I can take a photo and it saves it in the internal storage. I then save that path to a sqlite table. My database has an image id (_id) ex. 1, a vehicle id (v_id) ex 1, and a path to the image (i_image) ex /data/data/com.okc.vinstick/files/img_20120111_090000.jpg. I verified the image file and the database entry are being saved correctly. Now to the tough part: Displaying the images in a GridView. The ImageAdapter example i’m trying to follow is like this:

    public class ImageAdapter extends BaseAdapter {
    private LayoutInflater mInflater;
    public ArrayList<ImageItem> images = new ArrayList<ImageItem>();

    public ImageAdapter() {
        mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }

    public void initialize() {
        images.clear();
        final String[] columns = { MediaStore.Images.Thumbnails._ID };
        final String orderBy = MediaStore.Images.Media._ID;
        Cursor imagecursor = null;
        try {
            ContextWrapper context = MorePhotoTesting.this;
            imagecursor = context.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, columns, null, null, orderBy);
        } catch(Exception e) {
            e.printStackTrace();
        }

        if(imagecursor != null){
            int image_column_index = imagecursor.getColumnIndex(MediaStore.Images.Media._ID);
            int count = imagecursor.getCount();
            for (int i = 0; i < count; i++) {
                imagecursor.moveToPosition(i);
                int id = imagecursor.getInt(image_column_index);
                ImageItem imageItem = new ImageItem();
                imageItem.id = id;
                lastId = id;
                imageItem.img = MediaStore.Images.Thumbnails.getThumbnail(getApplicationContext().getContentResolver(), id,
                        MediaStore.Images.Thumbnails.MICRO_KIND, null);
                images.add(imageItem);
            }
            imagecursor.close();

        }
        notifyDataSetChanged();
    }

I believe once I understand the initialize() I can hammer out the getView(). Obviously the example is using the Mediastore where I will be using app internal storage. I’m just lost, and my research has come up empty. I just don’t see how to replace the Mediastore stuff with my database code. If anyone can point me in the right direction that would be great! By the way the example uses a class:

    class ImageItem {
    boolean selection;
    int id;
    Bitmap img;
}

the calls from the main activity look something like this:

    imageAdapter = new ImageAdapter();
    imageAdapter.initialize();
    imagegrid = (GridView) findViewById(R.id.PhoneImageGrid);
    imagegrid.setAdapter(imageAdapter);

I apologize but this is my first project dealing with these features.

  • 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-28T03:31:07+00:00Added an answer on May 28, 2026 at 3:31 am

    I’m not totally sure if there’s a specific question here, but I notice in your code the following line:

    imagecursor = context.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, columns, null, null, orderBy);
    

    Since you are storing your images in the internal phone storage, you should probably be using MediaStore.Images.Media.INTERNAL_CONTENT_URI, at least.

    I also notice you’re using getThumbnail(). This will only work with content stored on the sdcard.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I am writing an app with both english and french support. The app requests
I am using Paperclip to handle profile photo uploads in my app. They upload

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.