Questions tagged [android-spinner]

1

votes
3

answer
285

Views

How to set background of MaterialBetterSpinner in android?

This is my Design of campaign_create.xml Spinner : @drawable/rounded_white.xml I want to set background of spinner. It is drawable file. i set property android:background='@drawable/rounded_white' but it didn't work. How to set background of spinner?
Unnati Patadia
1

votes
1

answer
42

Views

Keep Android Spinner from dropping list

I have an Android spinner that I would like to disable when there's less than one item in my list. What I mean by that is I would like the title to show up, but I don't want a list to drop down when I click it. I've tried isClickable = false, and isEnabled = false like in many of the posts out there...
Rafa
1

votes
1

answer
59

Views

ListView inside / with spinner

Experts,I been struggling to solve the below issue. Have got code which basically searching the data using edittext to spinner which is working fine. But issue is i am unable to open the spinner to see the inside contents.Used AdapterView.OnItemSelectedListener but no use. Your most welcome to modif...
Leace
1

votes
0

answer
33

Views

Unable to select items from the Spinner in Android Studio

I am new to Android Studio, so I don't know much about the functions. I am using a spinner which allows me to choose from different languages. In my MainActivity class, I have the following code: String lang='eng'; dropdown.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { publi...
Hars
1

votes
2

answer
47

Views

Appearance issue in spinners in Android studio

I put two spinners in the same activity, one for City and the other for Town. When the user chooses a City, the Town spinner should populate with items according to the City that was chosen. My problem is, the color of the background and the text is always different from the first one, however they...
Wessam Alkumait
1

votes
0

answer
83

Views

rotate spinner arrow android

i am trying to rotate spinner arrow when spinner click. i try different solution but not get exact result. i want that rotate arrow from up to down when it select. this is my xml code for spinner. this is in activity. ss=(Spinner)findViewById(R.id.pricespinner); ArrayAdapter spinnerArrayAdapter = n...
1

votes
0

answer
32

Views

Disable spinner from moving to last selected item on dropdown

I have a spinner where I am adding hint at the bottom(not adding to top as getSelectedItemPosition will consider the hint as well) using arrayadapter hiding it from showing on dropdown options. The problem I am facing is, if I make the hint to show for the first time by using setSelection, then drop...
User007
1

votes
0

answer
152

Views

Unable to set height for Android Spinner popup in API 21 and 22

Herewith I used 'spinner' with some styles. To set height of the spinner popup, I used 'List Popup Window'. It's working fine for more Android versions. But API 21 and 22 (Android 5.0 and 5.1) not supported. Below is my code that I found from How to limit the height of Spinner drop down view in Andr...
Nuwan Withanage
1

votes
2

answer
52

Views

Spinner not saving the last selected value

I have a spinner in my android application and the spinner goes to the first item whenever I go to other fragment and come back. All I want is that the spinner should retain the value. Below is how I setup the spinner. private void setupSpinner(){ roundSpinnerMap = new HashMap(); roundSpinnerItems...
M.Shaikh
1

votes
2

answer
151

Views

onItemSelected doesn't work

I m having problems working with Spinner. I have a custom adapter for the Spinner. This is the code : public class CategoriaArrayAdapter extends ArrayAdapter { private Context context; private ArrayList values; public CategoriaArrayAdapter(Context context, int textViewResourceId, ArrayList values) {...
Coeus
1

votes
1

answer
91

Views

Android AppCompatSpinner will not dismiss and onItemSelectedListener not called

I have created a custom adapter for a AppCompatSpinner. the custom adapter is below: class MyAdapter(context: Context, var itemViewRes: Int, var dataSource: List) : ArrayAdapter(context, itemViewRes, dataSource) { override fun getDropDownView(position: Int, convertView: View?, parent: ViewGroup?): V...
j2emanue
1

votes
1

answer
61

Views

Android custom ArrayAdapter rendering Objects in list, not values

I'm trying to bind a custom layout (a LinearLayout containing two TextViews) to a Spinner. I subclassed ArrayAdapter (mostly) correctly. Selecting an item in the Spinner calls getView() correctly, setting the LinearLayout's TextViews' values correctly. The problem is the initial display of the items...
TheDudeDude
1

votes
1

answer
54

Views

How to set spinner selection if every field has key and value pair

I am updating a form in android fragment. In which i have spinner, i want to show default selected value in spinner but it is not working.I have searched a lot but nothing works. In function TruckApi.getTruckCapacity('update_truck'); i have added data to truckCapacityList and it is showing in spinn...
Narmail Sandhu
1

votes
0

answer
127

Views

Spinner in RecyclerView to update item values

How can I update the values in my Dataset from a Spinner selection in a RecyclerView? Should I be using LiveData and Room with notifyItemChange(), data binding, or something simpler? I have a Horseclass and a HorseData class. The number of items is static and the options for the variables are static...
MrG
1

votes
0

answer
90

Views

Center align spinner prompt text

I have an android spinner And a custom adapter attached to it. I manage to center text by passing my own layout in public View getView(int position, View convertView, ViewGroup parent) and public View getDropDownView(final int position, final View convertView, final ViewGroup parent) However it see...
Quillion
1

votes
1

answer
134

Views

Spinner dropdown height first time

I used spinner to make a dropdown of the country flags. But the dropdown height is not right at the first time as the images show, but it correct itself when I start scrolling in the dropdown or close it and open it again. I used custom adapter for the spinner class CustomAdapter(context: AppCompatA...
Andrew Hossam
1

votes
0

answer
62

Views

Spinner in RecyclerView Android

I am working on an app, In which I have a update data activity to modify the previous data. In this, I have created a recycler view. I want to fetch data from firebase database and set the spinner according to the value in the firebase. I am using a adapter for data in the spinner, so when I am tryi...
DevAndro
1

votes
0

answer
80

Views

getting data in spinner from retrofit - the application is crashing when click on item

I am getting data from a URL using Retrofit in Android. The response is getting data successfully, but when I click on item in the spinner the app crashes. Here is my code: public class Home extends Fragment { private Button adv_search; int PLACE_PICKER_REQUEST = 1; ArrayList items = new ArrayList()...
S.H
1

votes
1

answer
51

Views

Change the Text color of Spinner Using Textwatcher

Hi I want to change the Spinner text color using the text watcher.Spinner text should change color based on the character entered in edittext or empty edittext. Tried as below but not working if(charSequence.length() >0 ) { spin_motor_displacement.getViewTreeObserver().addOnGlobalLayoutListener(new...
hari86
1

votes
2

answer
31

Views

Populate Edit Text from spinner

I am working on code where for example the user selects a fabric called FabricA and when he selects it, it needs to populate an edit Text with FabricA price. i have tried to implement it but i cant get the price to show in the edit text. I stored the name and price in two different arrays. Should i...
Mohammed Ismail
1

votes
1

answer
36

Views

Checking which ArrayAdapter Spinner currently uses

I have four ArrayAdapters that uses 4 different arrays adapter1 = new ArrayAdapter(getApplicationContext(), android.R.layout.simple_spinner_item,getResources().getStringArray( R.array.array1) ); adapter2 = new ArrayAdapter(getApplicationContext(), android.R.layout.simple_spinner_item,getResources()....
GremlinShX
1

votes
1

answer
38

Views

How to get Specific id of an object in spinner

{ 'Schools': [ { 'SCHOOLRSN': '1', 'SCHOOLNAME': 'Name1' }, { 'SCHOOLRSN': '11', 'SCHOOLNAME': 'Name2' }, { 'SCHOOLRSN': '10', 'SCHOOLNAME': 'Name3' }, { 'SCHOOLRSN': '9', 'SCHOOLNAME': 'Name4' }, { 'SCHOOLRSN': '21', 'SCHOOLNAME': 'Name5' }] this is my JSON, and I want when I choose a name of a sc...
Prateek Gupta
1

votes
0

answer
165

Views

How to show spinner dropdown full screen?

I want to show spinner full screen..I reached i didnot get proper solution. XML Java ArrayAdapter dataAdapter = new ArrayAdapter(this,android.R.layout.simple_spinner_dropdown_item, categories) { @Override public View getDropDownView(int position, View convertView, ViewGroup parent) { View v = null;...
Gowthaman M
1

votes
0

answer
25

Views

fetch data for spinners from REST APi [cascade]

I have in one activity 6 spinners and at the beginnig to 1st one it fetchs data automatically using rest api and retrofit and the for another spinner i need use value which was selected from 1st spinner and fo the 3d spinner i need get selectedItem from second spinner and so on. i've allready (for f...
1

votes
1

answer
36

Views

custom spinner background is not working on lolipop devices

I have created a custom spinner which works perfectly with all devices except Android 5.0 Here is my code for spinner background This is how it looks other than lolipop devices other than lolipop And on lolipop devices layout.xml I have updated the queastion ..Please check the layout xml
NewBee
1

votes
0

answer
32

Views

spinner value updation by another spinner which uses autocomplete text view not working

I have two spinners in which the first spinner uses autocomplete textview , when first spinner item is selected in normal way without using autocomplete text view the second spinner loads the corresponding value according to the first spinners selection. My issue is that when autocomplete textview...
Kripa_K
1

votes
0

answer
54

Views

override default android attr styles

This is a very basic question I'm trying to create a spinner in my android layout. Then i found a website teaching how to create an ArrayAdapter for that spinner ArrayAdapter dataAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, new ArrayList(20)); dataAdapter.add(ImportGiveaway...
Rafael Lima
1

votes
1

answer
16

Views

How to detect that i reached the last postion of getSelectedItem of spinner after certain time

I change spinner item after certain interval using the following method: spinner.setSelection(spinner.getSelectedItemPosition()+1); When all item fetching completed app is crashed. Please assist me in order to determine when I've reached the last position of spinner item
Pampa Rana
1

votes
0

answer
62

Views

Custom adapter not display default text in spinner item

I want to display select all as default text in first spinner and for this I used custom adapter but I am unable to do this. I set code of adapter to bind data in spinner like this: private void getClientGroup() { final APIInterface apiInterface = APIClient.getClient().create(APIInterface.class); fi...
Nidhi Bhatt
1

votes
0

answer
61

Views

How to fill spinner with data from Room without blocking UI thread

I have pre-populated an Android Room database with the names of sports teams in a table. I want to populate a spinner on the activity below with those names. I need to run several similar tasks as well and cannot use the main thread for this. How can I do this using asynctask or executor? This data...
JJJ
1

votes
0

answer
23

Views

How to set default value of spinner

I have a spinner to Change font size of TextView, I use background for the spinner as shown in first picture. I have two problems, First: when I run the app the spinner looks like the second picture I don't want to show word 'Small' or any selection in the Spinner background.. Second problem: I want...
Mohamed Wessam
1

votes
1

answer
24

Views

Spinner with a underline and custom right arrow

I want to show spinner with a underline and a custom right arrow as shown below. I am setting below drawable as a background to spinner. It works for some devices but in some devices arrow appears on complete spinner with grey background like this- I am testing with Asus phone with API 21 in which I...
Android Developer
1

votes
1

answer
698

Views

Android - How to create a custom (different) spinner

I'm trying to build and populate a spinner. I have a problem populating it, it gives me the error 'The code for the static initializer is exceeding the 65535 bytes limit'. I need all items I've put inside spinner. My spinner is set in this way: public class Names { public static final String ALL_NAM...
Valerio
1

votes
1

answer
633

Views

How to display int value obtained from spinner in android

I am trying to convert a spinner value that i get (based off the position) into an int value which i can then display below the spinner. When i run the code it gets an error when i include the 'tv.setText(position);' line but i cant figure out why. I am trying ot set the text of the TextView tv to t...
spudsta
1

votes
1

answer
1.4k

Views

Use on “Adapter” for two (or more) parent views?

Is it possible to use one adapter class (and it's instance) (e.g. own sub-class of ArrayAdapter for two (or more) different views? In my Activity, I have two Spinner objects that are used to show (and select) related data: A list of parent categories and a list of sub-categories of the selected par...
IanH
1

votes
2

answer
5.4k

Views

How to change spinner background color?

I have prepared custom spinner with text color and text size using adapter.By default spinner background color while ,here i want to change white to some other color or image? Is there any change to change backgroung color of spinner?. Please help me
SuReSh PaTi
1

votes
1

answer
2.4k

Views

Problems with custom spinner alignment and width

I've created a custom spinner using my own ProjectSpinnerAdapter. I've also got another class which just inflates the layout but hasn't been implemented yet so is still using the standard spinner. I can't seem to get my custom spinner to align the same way as the standard spinner. I'm also having pr...
Luke
1

votes
1

answer
1.6k

Views

How to add EditText on spinner popup in android?

I need to add EditText on top of the Spinner popup for searching purpose. Is this possible? How to do this? give me any idea for this.
bharath
1

votes
1

answer
610

Views

Android: Force Close opening Spinner with ArrayList

I have a problem, very annoying problem, and I have absolutely no idea what is causing it! I am trying to make an Android application capable of reading an XML file, adding some data from the XML file to an ArrayList, and then putting the ArrayList in a Spinner. Here is part of my Shortcuts class. S...
1

votes
3

answer
1.2k

Views

Extra Line in Android Spinner

I'm writting an Android app. I have several spinners. Each one shows an extra line near the bottom and on the left and right sides of the spinner. Please see the image. Does anyone know why this is happening and how to fix it? Here's the entry in the xml file that defines the spinner: And here is th...
wholladay

View additional questions