0

I have stored stored some links from pictures with a text to it in my database, with this:

    int drawableID = context.getResources().getIdentifier("devil", "drawable", getPackageName());
    iv.setImageResource(drawableID);

    String info = String.valueOf(drawableID);

    mDbHelper.open();

    mDbHelper.createSmiley("You received a satanic message", info);

    mDbHelper.close();

Now I have defined a gridview in my layout like this:

        <GridView 
            android:layout_height="175dp" 
            android:layout_width="fill_parent" 
            android:gravity="bottom|right" 
            android:numColumns="5"
             >
        </GridView>

Now I want to import my pictures from my database that they are shown in my GridView and that I can select one of them. But I don't get how this works, how I can realize that? This is my method to import all Database entries:

    public Cursor getAllSmileys() {

        return this.mDb.query(DATABASE_TABLE, new String[] { ROW_ID,
                SOURCE, INFO }, null, null, null, null, null);
    }

So my Question is how I can import all those pictures into my gridview to show them? Also I'd like that the user can select one of them.

bstpierre
  • 30,042
  • 15
  • 70
  • 103
safari
  • 7,565
  • 18
  • 56
  • 82

1 Answers1

1

Check this Inserting image in Database and get it back.

For Storing image in Database , store it as BLOB and retrieve it back and show it..

In the above example i show how to insert the image in DB and display it it in Image View..

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Venky
  • 11,049
  • 5
  • 49
  • 66
  • if you take a closer look at my first fuction to save the pictures into the databse i only save the source to it, where the picture is located... – safari Sep 30 '11 at 12:52
  • @safari In my example i loaded image from Server and Store it in DB, you can get image from local and save it. All seems same right? – Venky Sep 30 '11 at 12:56