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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
All you have to do is, convert your image to it’s Base64 string representation:
and then, when retrieving, convert it back into bitmap:
However, I have to tell you that Base64 support is only recently included in API8. To target on lower API version, you need to add it first. Luckily, this guy already have the needed tutorial.
Also i have to tell you that this is a complex procedure and shareprefrence use only to store small amount of data such as user name and password that’s way you can also use such a method:
store image path (from sdcard) into Share preferences like this–
To load your image path you can use this
After getting you path you can use: