显示自数据库在GridView的所有图片 [英] Show all pictures from database in a GridView

查看:104
本文介绍了显示自数据库在GridView的所有图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已存储的存储从图片用文本来在我的数据库中的一些链接,这一点:

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();

现在我在我的布局是这样定义的gridview的:

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>

现在我想从它们在我的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);
    }

所以我的问题是我怎么能导入所有这些照片到我的GridView向他们展示?另外,我想,用户可以选择其中之一。

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.

推荐答案

勾选此<一个href=\"http://stackoverflow.com/questions/7516933/how-to-create-a-table-with-a-column-of-type-blob-in-a-dbadapter/7517573#7517573\">Inserting数据库中的图像,并把它找回来。

有关在数据库中存储的图像,其存储为BLOB和检索回来,并显示它。

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

让,如果你发现任何困难我知道..

Let me know if you find any Difficulty..

由于Venky ..

thanks Venky..

这篇关于显示自数据库在GridView的所有图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆