开发者

Show all pictures from database in a GridView

开发者 https://www.devze.com 2023-04-10 06:43 出处:网络
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());

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.


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..

0

精彩评论

暂无评论...
验证码 换一张
取 消