0

I am developing an application in which I converted a bitmap to string for some purprose. How can I convert that String into a Bitmap again?

2
  • what kind of String? do you mean you want to render text into an image? Commented Oct 28, 2010 at 10:23
  • No, I converted an Bitmap to String to do some work, no I want to convert it back... it looks like "android.graphics.Bitmap@43fd34c0" Commented Oct 28, 2010 at 10:26

1 Answer 1

2

I converted an Bitmap to String to do some work, now I want to convert it back... it looks like "android.graphics.Bitmap@43fd34c0"

Simply stated, you can't.

That string is produced by the default Object.toString() method. It does not encode the information content of the object, and there is nothing in the standard class libraries that will turn it back into a reference to the original object ... assuming that it still exists.

Your only hope is if you create a Map<String,Bitmap> and populate it with mappings; e.g.

Map<String, Bitmap> map = new HashMap<String, Bitmap>();
...
map.put(someBitmap.toString(), someBitmap);
...
Bitmap retrieved = map.get(someString);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.