Skip to content

Instantly share code, notes, and snippets.

@jophde
Created June 30, 2011 21:59
Show Gist options
  • Save jophde/1057372 to your computer and use it in GitHub Desktop.
Save jophde/1057372 to your computer and use it in GitHub Desktop.
nast
public void fillShelves() {
setContentView(R.layout.records);
LayoutInflater mLayoutInflater = getLayoutInflater();
int i = 0;
while (i != Records.this.aData.length()) {
LinearLayout recordShelves = (LinearLayout) mLayoutInflater.inflate(R.layout.record_shelf,
(ViewGroup) findViewById(R.id.records));
LinearLayout recordShelf = (LinearLayout) recordShelves.getChildAt(recordShelves.getChildCount() - 1);
ImageButton record;
for (int j = 0; j < recordShelf.getChildCount(); j++) {
record = (ImageButton) recordShelf.getChildAt(j);
try {
record.setTag(Records.this.aData.getJSONObject(i)
.getString("sImageUrl-small"));
// switch(display.densityDpi) {
// case DisplayMetrics.DENSITY_HIGH:
// record.setTag(Records.this.aData.getJSONObject(i)
// .getString("sImageUrl-med"));
// break;
// default:
// record.setTag(Records.this.aData.getJSONObject(i)
// .getString("sImageUrl-small"));
// }
record.setImageResource(R.drawable.default_artwork);
i++;
} catch (JSONException e) {
e.printStackTrace();
}
new API.DownloadImagesTask().execute(record);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment