Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - Using loop to initialize/draw textView items

Using loop to initialize/draw textView items

Put your problem here if it does not fit any of the other categories.

Using loop to initialize/draw textView items

Postby Tollas » Fri Jun 11, 2010 4:38 pm

I have 12 TextView fields named textView1 - textView12.
Each TextView will have 2 attributes set: SetText &
SetBackgroundColor which are read from an array (textValue[] and textBackground[]).

What I would like to do is write a for (or similar loop) statement to draw them in a loop rather than write each one individually.

Something like
Code: Select all
for(int Z=1; Z<=12; Z++){
     TextView textViewz = (TextView)findViewById(R.id.textViewZ);
     textViewZ.setText(textValue[Z]);
     textViewZ.setBackgroundColor(textBackground[Z]);
}


Unfortunately is looks for the variable textViewZ instead of textView1.
Tollas
Freshman
Freshman
 
Posts: 3
Joined: Fri May 28, 2010 5:15 pm

Top

Re: Using loop to initialize/draw textView items

Postby luugiathuy » Fri Jun 11, 2010 5:10 pm

Hi,

I think first you should create an array int textViewID[12] and store the value of R.id.textViewZ (Z = 1..12).

Then use it for your loop.

Hope this helps!
luugiathuy
Junior Developer
Junior Developer
 
Posts: 10
Joined: Tue Jun 01, 2010 3:16 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 9 guests