Last active
August 29, 2015 13:59
-
-
Save bgorkowy/10500049 to your computer and use it in GitHub Desktop.
ion samples, more on https://github.com/koush/ion
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
Ion.with(imageView) | |
.placeholder(R.drawable.placeholder_image) | |
.error(R.drawable.error_image) | |
.animateLoad(spinAnimation) | |
.animateIn(fadeInAnimation) | |
.load("http://example.com/image.png"); |
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
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()); | |
} | |
} | |
}); |
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
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