On Jun 8, 2012, at 8:38 PM, Melanie Peterson wrote:
> Context context = getApplicationContext();
> int ResID = context.getResources().getIdentifier(imageresource,
> "drawable", "com.KnitCard.project");
> chart.setImageResource(ResID);
Is it totally out of question to choose correct resource id programmatically
(instead of using db values as-is)?
int resId = -1;
if (parsedData[4].equals("norusdpyr")) {
resId = R.drawable.norusdpyr;
}
// ...etc, etc….
chart.setImageResource(resId);
Asking since you're referring to resource drawables only which may be easier to
handle in this way. E.g. you get to choose "error image" for situations you
receive a value from db there's no existing image resource for.
--
H
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en