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 - ArrayAdapter<String> cannot add(R.string.xxx01)

ArrayAdapter<String> cannot add(R.string.xxx01)

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

ArrayAdapter<String> cannot add(R.string.xxx01)

Postby slashgill » Thu Jan 28, 2010 4:12 pm

hi,

in my string.xml:
<string name="xxx01">example</string>

when i try to code like this:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. ArrayAdapter<String> adp =new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1);
  2. adp.add(R.string.xxx01);
  3.  
Parsed in 0.011 seconds, using GeSHi 1.0.8.4

i will got a error message like this:
The method add(String) in the type ArrayAdapter<String> is not applicable for the arguments (int)

In order to solve it, i use a stupid method like this:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. ArrayAdapter<String> adp =new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1);
  2. TextView temp_text = new TextView(this);
  3. temp_text.setText(R.string.xxx01);
  4. String temp_str = (String) temp_text.getText();
  5. adp.add(temp_str);
  6.  
Parsed in 0.010 seconds, using GeSHi 1.0.8.4


Does any one have a good solution? :?
Thanks.
slashgill
Junior Developer
Junior Developer
 
Posts: 16
Joined: Mon Jan 25, 2010 5:14 am

Top

Postby grzegorz.zajac » Thu Jan 28, 2010 6:08 pm

Should be:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. adp.add(getString(R.string.xxx01));
Parsed in 0.010 seconds, using GeSHi 1.0.8.4


Everything about this + examples are in reference guide & samples.

Regards,
Grzesiek
grzegorz.zajac
Developer
Developer
 
Posts: 39
Joined: Wed Feb 18, 2009 8:37 pm
Location: Krakow/Poland

Postby slashgill » Fri Jan 29, 2010 1:55 pm

It works.
Thanks for your help :D
slashgill
Junior Developer
Junior Developer
 
Posts: 16
Joined: Mon Jan 25, 2010 5:14 am

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Exabot [Bot] and 4 guests