How to store an image path in the shared preferences in android?
问题 I have got an image path that I want to store in the shared preferences. How do I store the path inside the shared preferences? How can I retrieve the image path from the shared preferences? 回答1: 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