Question

1) I have a android application which has a default background Image()

2) I have a login page where the user selects an item from a drop down list ..and depending on the item i make an API call to download an image.

3) Once the Image is downloaded i want to change the background of that page and also cache it so as to use the same image in rest of the pages

Can anyone suggest a way to do this. AM stuck on finding a solution since hours

Please help!!

Was it helpful?

Solution

1) I have a android application which has a default background Image()

Good start

2) I have a login page where the user selects an item from a drop down list ..and depending on the item i make an API call to download an image

Use AsyncTask to download the image in doInBackground()

3) Once the Image is downloaded i want to change the background of that page and also cache it so as to use the same image in rest of the pages

You can update the background in onPostExecute() of your AsyncTask. Save the image in a DB or maybe just to a file on the device or as a static variable in a Global class (not recommended by most)

I hope this can help you get started

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top