Created
April 1, 2011 16:34
-
-
Save abscondment/898441 to your computer and use it in GitHub Desktop.
update_from_json
This file contains hidden or 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
def update_from_json(json:String) | |
begin | |
data = JSONArray.new json | |
data.length.times do |i| | |
photo_json = data.getJSONObject(i) | |
@photos.add {'caption' => photo_json.getString('caption'), 'src' => photo_json.getString('src')} | |
end | |
rescue JSONException => e | |
Log.e 'LazyGalleryAdapter', 'Could not load JSON', e | |
end | |
notifyDataSetChanged() | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment