[Solved] How to store an image path in the shared preferences in android?
All you have to do is, convert your image to it’s Base64 string representation: Bitmap realImage = BitmapFactory.decodeStream(stream); ByteArrayOutputStream baos = new ByteArrayOutputStream(); realImage.compress(Bitmap.CompressFormat.JPEG, 100, baos); byte[] b = baos.toByteArray(); String encodedImage = Base64.encodeToString(b, Base64.DEFAULT); textEncode.setText(encodedImage); SharedPreferences shre = PreferenceManager.getDefaultSharedPreferences(this); Editor edit=shre.edit(); edit.putString(“image_data”,encodedImage); edit.commit(); and then, when retrieving, convert it back into bitmap: SharedPreferences shre … Read more