Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

how to set spinner value in android

String compareValue = "some value";
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.select_state, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mSpinner.setAdapter(adapter);
if (compareValue != null) {
    int spinnerPosition = adapter.getPosition(compareValue);
    mSpinner.setSelection(spinnerPosition);
}
Comment

how to set current item for spinner android

val b: List<Int> = a.mapIndexed { i, b -> if (b) i else null }.filterNotNull().toList()

spinnerObject.setSelection(b.get(0))
Comment

PREVIOUS NEXT
Code Example
Java :: java pair class 
Java :: convert long to localdatetime java 
Java :: java android join array list 
Java :: java indexof not found 
Java :: java if with string 
Java :: junit maven dependency 
Java :: java resto 
Java :: print a letter in java 
Java :: java compare char 
Java :: java how to write something on the console with scanner 
Java :: java, how to find the most repeated character 
Java :: void setup 
Java :: how to change my file into binary data using java 
Java :: devotional meaning 
Java :: round off and round up 
Java :: windows menu in java swing ausscahlten 
Sql :: mysql set safe mode off 
Sql :: all workbenches in minecraft 
Sql :: convert utc to est sql 
Sql :: mysql alter column default 
Sql :: oracle create synonym 
Sql :: alter table add comment oracle 
Sql :: how to export database mysql terminal ubuntu 
Sql :: start mysql server linux terminal 
Sql :: get current date in pyspark sql 
Sql :: ubuntu stop mysql 
Sql :: create table oracle 
Sql :: customer using hdfc bank sql query 
Sql :: how to run mysql in git bash 
Sql :: ubuntu stop mysql from starting on boot 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =