• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps get image path

Hi there, I am looking for a way to get the path of an image in ImageView and then save the to shared preferences. First time with me needing to save an app to restore its state on restart.

Thanks for any advice

Dan
 
I was told that this would be easy to impliment. The image is selected from presets within the app, The image path in this case is R.drawable.arrow
but if the user selects a different image this changes, how would I retrieve that info or is it the same as above?
 
Or is there a better alternative than this? I just thought passing the path would be easier on the program than passing around a picture :/ If that can be done
 
Ok, this can be done. I have managed to do it.
In my case the picture was predefined in the app so I called call the image directly in this case. it just means writing new code for every combination of choices which will be a pain rather than like .net where you can write a variable code allowing multiple results.

But this is the best solution I could come up with, was when the user sets the predefined image an intent is used to pass this info on as boolean which the calls for the image path and at this point I save the path as int and call for it later on form load under the setImageBackgound
 
Back
Top Bottom