Skip to content

Instantly share code, notes, and snippets.

@abscondment
Created April 1, 2011 16:34
Show Gist options
  • Save abscondment/898441 to your computer and use it in GitHub Desktop.
Save abscondment/898441 to your computer and use it in GitHub Desktop.
update_from_json
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