Search code examples
androidandroid-studioimagebuttonandroid-imagebuttonandroid-mipmap

android studio imagebutton from internet


i am programming an app with AndroidStudio and want to use an ImageButton to Display an Image. The Problem is, that this Image is from the Internet and I just found a method to use Pictures in the R.mipmap.*** for the ImageButton.

Does anyone have an idea how it may work

Thankyou

Prog Rammer


Solution

  • If you want to load an image from the internet, I recommend you use an Image library like Glide or Picasso for this. Create an ImageView with an OnClickListener on it, then call the library's load(...) method with the image url.

    The mipmap folders are for placing your app/launcher icons, and should not be used for placing assets in app.

    I believe using the Image Library mentioned is the simplest solution, since loading an Image from the internet on your own takes a lot of boilerplate code.