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
[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 - Spinner: Is there no getIndex() method?

Spinner: Is there no getIndex() method?

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

Spinner: Is there no getIndex() method?

Postby tritop » Sat Dec 26, 2009 12:23 am

Hi is there any way to get the Index of an Element in a Spinner?
I got a spinnner filled with an string array from xml.
What i want to do is set the Spinner to a default value in my subactivity when the Activity is created from a main activity. So what i need is something like spinner.setSelection(spinner.getIndex("string_to_be_preselected")). But the Spinner doesnt seem to have a method to find the Index of an item?
tritop
Once Poster
Once Poster
 
Posts: 1
Joined: Mon Dec 14, 2009 4:49 pm

Top

Re: Spinner: Is there no getIndex() method?

Postby jagtap.jj1 » Wed Dec 30, 2009 11:13 am

There is way
mSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
public void onItemSelected(AdapterView<?> parent, View view, int position, long id)
{
// Here position will give u the index
}
public void onNothingSelected(AdapterView<?> parent){

}
});
java-android developer
User avatar
jagtap.jj1
Senior Developer
Senior Developer
 
Posts: 124
Joined: Fri Aug 22, 2008 11:52 am
Location: India(Mumbai)

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 6 guests