我正在使用Android中的Picasso库开发一个具有离线功能的项目.到目前为止,我只是按照教程.
这是我的傻瓜:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.google.firebase:firebase-database:9.0.2'
compile 'com.google.firebase:firebase-core:9.0.2'
compile 'com.google.firebase:firebase-auth:9.0.2'
compile 'com.firebase:firebase-client-android:2.3.1'
compile 'com.google.firebase:firebase-storage:9.0.2'
compile 'com.google.firebase:firebase-database:9.0.2'
compile 'com.firebaseui:firebase-ui-database:0.4.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
}
Run Code Online (Sandbox Code Playgroud)
这是我毕加索的设定:
Picasso.Builder builder = new Picasso.Builder(this);
builder.downloader(new OkHttpDownloader(this,Integer.MAX_VALUE)); //always give me the error to this line
Picasso built = builder.build();
built.setIndicatorsEnabled(false);
built.setLoggingEnabled(true);
Picasso.setSingletonInstance(built);
Run Code Online (Sandbox Code Playgroud)
这就是我在毕加索中称之为毕加索的方式actvity.java:
Picasso.with(this.getApplicationContext()).load(stringUriProfile).networkPolicy(NetworkPolicy.OFFLINE).into(mUriImageProfile, new Callback() {
@Override
public void onSuccess() {
//the function fires whenever the picasso doesnt …Run Code Online (Sandbox Code Playgroud)