質問

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!!

役に立ちましたか?

解決

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

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top