Skip to content

Instantly share code, notes, and snippets.

@bgorkowy
Last active August 29, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bgorkowy/10500049 to your computer and use it in GitHub Desktop.
Save bgorkowy/10500049 to your computer and use it in GitHub Desktop.
ion samples, more on https://github.com/koush/ion
Ion.with(imageView)
.placeholder(R.drawable.placeholder_image)
.error(R.drawable.error_image)
.animateLoad(spinAnimation)
.animateIn(fadeInAnimation)
.load("http://example.com/image.png");
Ion.with(context, "http://example.com/thing.json")
.asJsonObject()
.setCallback(new FutureCallback<JsonObject>() {
@Override
public void onCompleted(Exception e, JsonObject result) {
try {
if (e != null) {
throw e;
} else {
// process data
}
} catch (Exception ex) {
// log exception
Logger.error(ex.toString());
}
}
});
Ion.with(context, "http://example.com/thing.json")
.asString()
.setCallback(new FutureCallback<String>() {
@Override
public void onCompleted(Exception e, String result) {
try {
if (e != null) {
throw e;
} else {
// process data
}
} catch (Exception ex) {
// log exception
Logger.error(ex.toString());
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment