//For a simple view:
@Override
public void onCreate(Bundle savedInstanceState) {
...
ImageView imageView = (ImageView) findViewById(R.id.my_image_view);
Glide.load("http://goo.gl/h8qOq7").into(imageView);
}
//For a list:
@Override
public View getView(int position, View recycled, ViewGroup container) {
final ImageView myImageView;
if (recycled == null) {
myImageView = (ImageView) inflater.inflate(R.layout.my_image_view,
container, false);
} else {
myImageView = (ImageView) recycled;
}
String url = myUrls.get(position);
Glide.load(url)
.centerCrop()
.placeholder(R.drawable.loading_spinner)
.animate(R.anim.fade_in)
.into(myImageView);
return myImageView;
}
Status
Glide has been in use at Bump for about six months in two of our Android apps at version 1.0. Version 2.0 is the first public release with a stable api. Comments/bugs/questions/pull requests welcome!
Build
Building Glide with gradle is fairly straight forward:
cd glide/library
./gradlew build
Note: Make sure your Android SDK has the Android Support Repository installed, and that your $ANDROID_HOME
environment variable is pointing at the SDK.
Thanks
Thanks to the Android project and Jake Wharton for the disk cache implementation included with Glide. Thanks also to the Android team for Volley.
Author
Sam Judd - @samajudd