MyApp
public class MyApp extends Application{ public static SharedPreferences preferences; public static SharedPreferences.Editor editor; @Override public void onCreate() { super.onCreate(); DiskCacheConfig diskCacheConfig = DiskCacheConfig.newBuilder(this) .build(); ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this) .setMainDiskCacheConfig(diskCacheConfig) .build(); Fresco.initialize(this,config); preferences=getSharedPreferences("user",MODE_PRIVATE); editor=preferences.edit(); } }
GlideImageLoader
public class GlideImageLoader extends ImageLoader { @Override public void displayImage(Context context, Object path, ImageView imageView) { Uri uri = Uri.parse((String) path); imageView.setImageURI(uri); } @Override public ImageView createImageView(Context context) { SimpleDraweeView simpleDraweeView=new SimpleDraweeView(context); return simpleDraweeView; } }