3

I have a program that have images(default) for background , but user can change and select images for background . But if i close the program and open again the images go back to default . How to save the changed images in my program ?

Thanks...

user3582100
  • 121
  • 1
  • 11
  • 1
    whenever user changes images you had to save that image in temporary storage like database or assets folder . than retrieve them and reset on imageviews when coming back by onresume method. – ShujatAli May 07 '14 at 18:08

2 Answers2

1

You're going to need to save the preferences to some sort of external properties of preferences mechanism. The properties will not be persisted without it.

MKyong has a simple example of using properties files. You can also see the Official Java tutorial for Properties

You'll probably also want to have a look at the Java Preferences API. Also here's a more/most recent documentation

Paul Samsotha
  • 205,037
  • 37
  • 486
  • 720
0

You can use the App Data folder and persist some metadata (JSON or XML) with the image ID, after open your application you check the metadata and update your background.

To get your app data folder you can do

System.getProperty("user.dir");
Victor Laerte
  • 6,446
  • 13
  • 53
  • 102