0

I have this app , it consists of two activities:

  1. activity 1 : inserts data.
  2. activity 2 : show inserted data.

Now on activity 1 I want to store data with key \ value that can be stored in a single file .

For example:
one file would store three strings and one image.

I've tried using sharedPreferences but it does not store images also when I encode the image to Base64 and then put in the sharedPreferences. then the stored sharedPref.xml size becomes over 150K and my image is only 5K

So what I want to do is store values with image in one single file and then transfer those files to be displayed in the second activity.

How can I do this?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Mohamad Hamad
  • 21
  • 1
  • 4
  • Save the image files in the internal storage. And in your key/value storage, let the value be the path of the saved image. – Ahmed Khalaf Apr 08 '16 at 14:26
  • Take a look at [Content Providers](http://developer.android.com/guide/topics/providers/content-provider-basics.html) - it gives you the ability to do just that. It involves a little bit more work but is scalable. – zec Apr 08 '16 at 14:27

1 Answers1

0

dont need to store image at sharedpreference( actually its not possible) .. just you need to save image path only as a value and save the image in sd card or phone memory . and load the image again at second activity from sd card and get the image path from sharedpreference.

save image on sd card

how to save the image to sd card on button click

Community
  • 1
  • 1
Tanim reja
  • 2,120
  • 1
  • 16
  • 23