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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:22:04+00:00 2026-05-30T22:22:04+00:00

I am not sure whether the question title is proper or not, but after

  • 0

I am not sure whether the question title is proper or not, but after searching a lot I am asking this.

In my SQLite table, I have the columns

1: _id   2: position   3: path

position: the position of the gridView where the Image is to set
path:  the path of the SDCard having corresponding image

How would I get the image from the path and set into the GridView

GridView grid = (GridView) findViewById(R.id.play_grid_view);
DBAdapter adapter = new DBAdapter(this); //My costum adapter for databse operation
adapter.open();
Cursor cusor = adapter.getAllImages(); //returns cursor with 3 columns mentioned above
startManagingCursor(cusor);

After this what should I do?

  • 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-30T22:22:06+00:00Added an answer on May 30, 2026 at 10:22 pm

    If your position column means the position of image in grid, you can just sort your query with this column, then cursorAdapter will fill your grid according to positions set in your DB.

    This is not usable, if you will skip some of gridview cells (suppose you have following positions in your database: 1,2,4 – then your this adapter will fill positions 1,2,3 as there is actually no position checking)

    public class ImageCursorAdapter extends CursorAdapter {
        public ImageCursorAdapter(Context context, Cursor c) {
            super(context, c);
        }
    
        @Override
        public void bindView(View view, Context context, Cursor cursor) {
            String pos = cursor.getString(positionColumnIndex);
            String path = cursor.getString(pathColumnIndex);
            ImageView image = (ImageView)view;
            image.setImageDrawable(Drawable.createFromPath(path));
        }
    
        @Override
        public View newView(Context context, Cursor cursor, ViewGroup parent) {
            View v = new ImageView(context);
            bindView(v, context, cursor);
            return v;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Not sure whether this is the right place, but I have a question related
I'm not sure whether this question belongs on StackOverflow or SuperUser, but here goes
I am not sure whether I have described the question properly, but currently I
I'm not sure whether I'm asking the question correctly, but I've been told SQL
I have read this question and I'm still not sure whether it is possible
I'm not sure whether this is an SO question but still would like to
Not sure whether this is a MSMQ or NServiceBus question, but I'm wondering: Should
I am not sure whether Stackoverflow is the right place for this question, but
Not sure whether to ask this question here but here is the question. What
I am not sure whether this forum is appropriate for this question. But, I

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.