I know that changing the ImageView resource is not big deal just using myImageView.setImageResource(mynewImageDrawable)
but what I want to do is to chec
You can use this.
private Drawable colocaImgen(String nombreFile) {
Drawable res1 = null;
String uri1 = null;
try {
//First image
uri1 = "@drawable/" + nombreFile;
int imageResource1 = getResources().getIdentifier(uri1, null,getApplicationContext().getPackageName());
res1 = getResources().getDrawable(imageResource1);
} catch (Exception e) {
// TODO Auto-generated catch block
//int imageResource1 = context.getResources().getIdentifier(uri1, null, context.getApplicationContext().getPackageName());
res1 = getResources().getDrawable(R.drawable.globo2);// Default image
}
return res1;
}
Then
((ImageView) findViewById(R.id.youNameFile)).setImageDrawable(colocaImgen("NameFile"));