I have images in my local database that I want to populate in the list view.
This is what I am doing:
... bitmap [i] = MySQLiteHelper.getImage (picture [i]); // It fetches a bitmap image from the database ... Here, I am converting my bitmap into a drawable.
d [i] = new bitmapdraw (getResources (), bitmap [i]); Then I am using Hashmap method to set it as a list list using Drawable.
hm.put ("img", string valueOf (d [i])); // put () accepts java.lang.String as input. But the image is not displayed in the list view. I am capable of displaying all the text, but not the image.
I get the following error in my log cassette:
Bitmap Factory: Unable to decode the stream: java.io.FileNotFoundException: android .graphics.drawable.BitmapDrawable @ 3ab28e36: Open failed: ENOENT (no such file or directory) Hull URI has failed on bad bitmap: android.graphics.drawable.BitmapDrawable@3ab28e36 What am I doing wrong here? I think that when bitmap is converted to drawable, then there is a temporary value in the drauble and can not (enter) it? Are people wrong, any help please?
Edit:
My Hashmap Code:
List & Lt; Hashmap & lt; String, string & gt; & Gt; ALIIT = New Arrestist & lt; Hashmap & lt; String, string & gt; & Gt; (); For (Int i = 0; I getImage () method:
Image (bitmap) is stored in database as Blob. I received it as a byte now, I am converting it back into bitmap using the method below.
Bitmap to publicmatic bitmap getImage (byte [] image) from // byte array {return BitmapFactory.decodeByteArray (image, 0, image.length); } My logger: after using Base64 bitmap to string Code>
(Note: consider using the new instead of ListView for better performance)
Whatever you are trying to do is either converting string to bitmapdable (in case MySQLiteHelper.getImage () a String as a path pointing to an image, usually you will not store binary data in a database) or BitmapDrawable to a string Can change in In both cases there really is no point in it
The way it is usually done: Applying a supportive class and then parameterizing your ListView's adapter with your examples. There are really many examples around the web, use a database, or
No comments:
Post a Comment