I stored my drawables
list into sharedPreferences
as Strings.
They were stored as follow:
android.graphics.drawable.BitmapDrawable@269d6f8
android.graphics.drawable.BitmapDrawable@1c71e5b
Now I want to convert them back to Drawable so I can use them. Any Ideas?
Code
SharedPreferences.Editor editor=sharedpreferences.edit();
editor.putString(s.getName(),(s.getLogo().toString()));
editor.commit();
And my Service s is defined as:
public Service(String name, Drawable logo) {
this.name = name;
this.logo=logo;
}
I tried to do this but it didn't work
String logo=entry.getValue().toString();
//convert string to drawable
byte [] encodeByte=Base64.decode(logo, Base64.DEFAULT);
Bitmap bitmap= BitmapFactory.decodeByteArray(encodeByte, 0, encodeByte.length);
Drawable d = new BitmapDrawable(bitmap);