0

how can I get image asset(from online or somewhere else) so that i can insert an image in my android app using android studio?

2 Answers2

0

Using Image library is easy way. (like Glide, Picasso, etc.)

for example. (using Glide)

    String imageUrl = "https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory&fname=https://k.kakaocdn.net/dn/EShJF/btquPLT192D/SRxSvXqcWjHRTju3kHcOQK/img.png";
    Glide.with(this).load(imageUrl).into(ivImage);

it make image from url.

Plus. how you can use Glide

  1. Add the dependencies in build.gradle(app)

    dependencies { implementation 'com.github.bumptech.glide:glide:4.9.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0' }

and use it.

more info is here

S T
  • 1,068
  • 2
  • 8
  • 16
0

The best way to do would be to use third party image libraries like Glide, Picasso, etc. Here is how you can easily do it using Glide

Add the dependencies in build.gradle(app)

dependencies {
  implementation 'com.github.bumptech.glide:glide:4.9.0'
  annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
}

Using Glide to fetch the images

ImageView targetImageView = (ImageView) findViewById(R.id.imageView);  
String internetUrl = "http://i.imgur.com/DvpvklR.png";

Glide  
    .with(context)
    .load(internetUrl)
    .into(targetImageView);

You can refer to this tutorial for more

Sonu Sourav
  • 2,926
  • 2
  • 12
  • 25