I gotta extract images from internet and apply them as a LinearLayout’s background – is it possible ? I haven’t seen any appropriate methods for this yet.
I gotta extract images from internet and apply them as a LinearLayout’s background –
Share
Sure.
Just get the InputStream of the image:
Get the Drawable from the stream:
Then set the LinearLayout Background Drawable:
This actually sets the image directly from the stream. You may want to use an ASyncTask to pull down the drawable in the background and set it afterwards:
http://developer.android.com/reference/android/os/AsyncTask.html
You may want to research lazy loaders as well:
http://evancharlton.com/thoughts/lazy-loading-images-in-a-listview