在对于SQLite数据库Android的存储图像路径

编程入门 行业动态 更新时间:2024-10-25 04:19:49
本文介绍了在对于SQLite数据库Android的存储图像路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我开发打算将数据存储在SQLite数据库的应用程序。这是怎样的一个虚拟城市指南。结果如此,我存储在DB中的一些文本元素,我想以存储存储在不同的列和DB的表装置的图像的路径和一个视频

I'm developing an application that intends to store the data in a SQLIte database. It's kind of a virtual city guide. As so, I'm storing some text elements on the DB and I'd like to store the path of an image and a video stored in the device in different columns and tables of the DB.

种类:

_ID INTEGER PRIMARY KEY AUTOINCREMENT (id of the image) IMAGE_PATH TEXT UNIQUE (path of the image associated with the ID)

谁能给我如何能做到这一点的例子吗?

Can anyone give some examples on how can I do this?

推荐答案

比尔加里的答案很适合一个图像,但我想这样做我用下面的code画廊:

The answer of Bill Gary works well for one image, but as I want to do a gallery I used the code below :

this.imgPath = new String[mImageCursor.getCount()]; int i = 0; while (mImageCursor.moveToNext()) { imgName = mImageCursor.getString(mImageCursor.getColumnIndex(MyDbAdapter.IMAGE_PATH)); Log.w(TAG, baseDir + imgName); this.imgPath[i] = baseDir + imgName; Log.w(TAG, baseDir + mImageCursor.getString(mImageCursor.getColumnIndex(MyDbAdapter.IMAGE_PATH)) + " After"); i++; } Gallery gallery = (Gallery) findViewById(R.id.VGgallery); gallery.setAdapter(new MyImageAdapter(this, this.imgPath));

希望它可以帮助别人。

Hope it helps someone else.

更多推荐

在对于SQLite数据库Android的存储图像路径

本文发布于:2023-10-07 10:39:11,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1469165.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:路径   图像   数据库   SQLite   Android

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!