How to use an image in android application that is saved on a web server?

Asked

Viewed 69 times

-1

I have an android application that selects an image of Sdcard and sends it to a php webservice that saves the image on a server and writes the image path to the database (Mysql). What I wanted to do now is take this image that is saved on the server and display it in this same android application. That is, do the reverse process of sending the image to the application. I have no idea how to do that, someone could help me with this problem?

1 answer

0


Just use libraries like Glide or Picasso. Ex (Glide):

Add these dependencies to your file app/build.gradle:

dependencies {
  compile 'com.github.bumptech.glide:glide:4.0.0'
  compile 'com.android.support:support-v4:25.3.1'
  annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0'
}

And in the code make that call:

@Override public void onCreate(Bundle savedInstanceState) {
  ...
  ImageView imageView = (ImageView) findViewById(R.id.my_image_view);

  GlideApp.with(this).load("URL_DA_IMAGEM").into(imageView);
}

More details on: https://github.com/bumptech/glide

  • It worked when I switched the GlideApp by just Glide (although the Glide documentation has an example using GlideApp), getting: Glide.with(this).load("URL_DA_IMAGEM").into(imageView); Thank you very much!

  • I also never used this Glideapp, but as I saw that came out version 4, I imagine it was a change.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.