0

I am new to android. I would like to know how to retrieve stored images from a database. No add or delete functionality. I want to retrieve already stored images from a database. Please help me achieve this.

SceLus
  • 1,082
  • 13
  • 18

2 Answers2

0

This answers assumes that you are retrieving images from a database in another app (because you'd already now how to retrieve images from a database that you created).

If the database is within another application, you must use a content provider. This link will redirect you to the official documentation. It covers all you will need to know about content providers.

In the most basic terms ever, to use a content provider you must first ask permission. Then you query the application that stores the database rather than the database itself (note: the application you query in turn queries the database). Therefore, you must have documentation that will provide predefined methods that must be used.

0

Not sure what really you want.

But if you finding a simple way to store image to database, you can try base64 image, it is like a string so simple store and read it in/from database.

To display base64 image on html, use can you

<img src="data:image/gif;base64,base64_data_here"/>

Reference to more information:

  • To convert your image to base64

How to convert a image into Base64 string?

  • To convert base64 to image:

How to convert a Base64 string into a BitMap image to show it in a ImageView?

Community
  • 1
  • 1
Hardy
  • 1,329
  • 2
  • 22
  • 33