Picasso Custom Downloader Issue

android, httpurlconnection, java, okhttp, picasso

Solution

Do not use `Picasso.with()`. That's a static method that initializes the default `Picasso` instance.

You are building an instance of yours with the custom downloader but you are not using it.

Just call `picasso.load()` directly after your build your instance.

Problem

I need to retrieve an image from my api that requires header authentication. I am specifying a custom downloader for Picasso but the image is never display. Am I overriding the openConnection method correctly? ``` Picasso.Builder builder = new Picasso.Builder(getApplicationContext()); builder.downloader(new OkHttpDownloader(getApplicationContext()) { @Override protected HttpURLConnection openConnection(Uri uri) throws IOException { HttpURLConnection connection = super.openConnection(uri); connection.setRequestMethod("GET"); connection.setRequestProperty("X_AUTH_TOKEN", authToken); return connection; } }); Picasso picasso = builder.build(); picasso.with(getApplicationContext()).load("http://example.com/api/users/pic/14").into(ivProfilePic); ```

Original source