• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

How to set variable in RefID

Yahyaaa

Lurker
Hello great forum

Im new to android field, i have a little java experience :-)
so excuse me if my question was simple ...

Thanks in advance

I have a variable called "position" which is an output of ListAdapter, as you see am trying to use this variable to view an image based on it, see my approach
Code:
holder.imageView.setImageResource(R.drawable.pic" + position + "_1");
the final output should be like (assuming that "position" variable was 1)
Code:
holder.imageView.setImageResource(R.drawable.pic1_1);
ofcourse this is wrong because I should use the id, not a string...
can anybody help ?
 
I can't help you with your question. I would like to welcome you to Android Forums though. I would also suggest you take a look at the overview of this site. It consists of many sub forums including development etc. Here is a link to that overview: http://androidforums.com/
 
Back
Top Bottom