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.