Skip to content

Instantly share code, notes, and snippets.

@benlieb
Created August 8, 2013 08:38
Show Gist options
  • Save benlieb/6182784 to your computer and use it in GitHub Desktop.
Save benlieb/6182784 to your computer and use it in GitHub Desktop.
if (!download_data.getBoolean("currently_downloading", false))
{
//find the first one whose percent is 0 and start it.
Map<String, ?> items = download_data.getAll();
for(Map.Entry<String,?> entry : items.entrySet()){
if (entry.getValue() instanceof Integer) { //this is a cheap way to test if the key/value pair is 'about' a download. All other values, e.g. 'currently_downloading' are not Integers. This may change.
if (entry.getValue() == 0)
{
Integer position = Integer.parseInt(entry.getKey());
Download d = new Download();
d.start(position);
return;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment