vendredi 20 mars 2015

how to setImageResource in listview?

i store image name in sqlite, i get names with a query and i need to set image resource. i try this :



ImageView img_categlist = (ImageView) findViewById(R.id.img_categlist);
int imageid = getResources().getIdentifier(Image[position], "drawable", getApplicationContext().getPackageName());

img_categlist.setImageResource(imageid);

int save = db.sh_categtest("charterdb", "test");
Image = new String [save];

for (int i = 0; i <save; i++) {
Image[i]= db.nam_nametest("charterdb", "test", i, 15);
}


but it is not working, how should i do it?


Aucun commentaire:

Enregistrer un commentaire