Skip to content

Instantly share code, notes, and snippets.

@ssteuteville
Last active August 29, 2015 14:00
Show Gist options
  • Save ssteuteville/11389522 to your computer and use it in GitHub Desktop.
Save ssteuteville/11389522 to your computer and use it in GitHub Desktop.
loopj + initialize database
if champion data base doesn't exist
{
client.get(url, null, new JsonHttpResponseHandler() {
@Override
public void onSuccess(JSONObject response)
{
button1.setVisibility(View.GONE);
button2.setVisibility(View.GONE);
button3.setVisibility(View.GONE);
progressBar.setVisibility(view.visible);
try {
JSONObject champs = response.getJSONObject("data");
JSONArray names = champs.names();
for(int i = 0; i < names.length(); i++)
{
String name = names.get(i).toString();
String id = champs.getJSONObject(name).get("id").toString();
//update database
}
}
catch (Exception ex)
{
}
button1.setVisibility(View.visible);
button2.setVisibility(View.visible);
button3.setVisibility(View.visible);
progressBar.setVisibility(view.gone);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment