There are TextView
and ImageView
I can not understand how you can display the value of the string and the picture. The values in xml are written as stroka1
, stroka2
, stroka3
, and the pictures are named img1,
img2
, img3
.
I have:
int nomerstroki; // где значение для строки.
How can I substitute a value for text output from String
and Drawable
? I fight for two days, I found that there is a dynamic query, but I did not understand anything ...
The code is simple to horror, there are only two elements in the layout - text and image, and their values are programmed in the activation:
TextView mDateName = (TextView) findViewById(R.id.text_3); ImageView imgview = (ImageView) findViewById(R.id.img_3);
specify for each value a lot of code. so HOW to specify TO
int get_num = ActivityUtil.getNum(); TextView mDateName = (TextView) findViewById(R.id."text_"+get_num ); ImageView imgview = (ImageView) findViewById(R.id."img_"+get_num );
Of course, with this option, the text text_3
and img_3
, but it is necessary that the value be derived from the string