I’m looking for a very basic function. I’m trying to design an app and all I want it to do is load an image from a URL.
I’ve found a few questions and websites, but they all seem to be older and dated, but what I think I’m having issues with is linking the code to activity main.xml for ImageView.
Any suggestions or links you have I would greatly appreciate, thank you.
Here, this is how I display image from url in the image view
you have to call this code from thread other than main thread
Be careful don’t forget to surround the code with try catch(I have already done that in this code)
or you can use webview to load image from url
if you are trying to load image from the assets folder url will start like this
“file:///android_asset/yourimage.jpg”
else normal internet url like this
“http://0.tqn.com/d/webclipart/1/0/5/l/4/floral-icon-5.jpg“
hope this works for you
Good Luck