Glide.load from request

1

In my android application I am using the Glide library for loading images, but I need to upload images that are only obtained with POST calls and a certain body (they do not return with just one URL).

For now what I do is download the images from another thread and already stored the load with load (URI) but it is inefficient, I hope you can help me.

Thank you.

    
asked by Mlg 07.07.2016 в 17:35
source

1 answer

0

You can do this with AsyncTask, in doInBackground () you can obtain the image and when you finish it executes onPostExecute () which is where you would load the url of the image using Glide.

new AsyncTask<String, Void, String>() {
            @Override
            protected Void doInBackground(String... params) {
           String urlPost = params[0];     
                //Obtiene urlImagen mediante POST.
                //retorna la url de la imagen obtenida.
                 return urlImagen;
            }
            @Override
            protected void onPostExecute(String urlImagen) {
                if (!urlImagen.equals("")) {
                    //En base a la url obtenida carga la imagen por medio de Glide.
                };
            }
        }.execute();
    
answered by 08.07.2016 в 06:14