Last active
April 17, 2016 07:13
-
-
Save wuapnjie/fa3900c4564cd700f26301914eb2021a to your computer and use it in GitHub Desktop.
Using Stetho to inspect picasso's network task
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class App extends Application { | |
@Override | |
public void onCreate() { | |
super.onCreate(); | |
Stetho.initialize(Stetho.newInitializerBuilder(this) | |
.enableDumpapp(Stetho.defaultDumperPluginsProvider(this)) | |
.enableWebKitInspector(Stetho.defaultInspectorModulesProvider(this)) | |
.build() | |
); | |
OkHttpClient client = new OkHttpClient(); | |
client.networkInterceptors().add(new StethoInterceptor()); | |
Picasso picasso = new Picasso.Builder(this) | |
.listener((picasso1, uri, exception) -> { | |
Log.e("Picasso", "picasso load image failed, uri -> " + uri, exception); | |
}) | |
.downloader(new OkHttpDownloader(client)) | |
.build(); | |
Picasso.setSingletonInstance(picasso); | |
Picasso.with(this).setIndicatorsEnabled(true); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment