Questions tagged [android-spinner]

0

votes
0

answer
6

Views

how to support all screen sizes when using more than one spinner?

I am making a new app and I am a beginner so kindly help me with this, my layout is working great if I run without any java code for layout but when I use Java code, my layout is going beyond the screen I have tried to make different layout folders such as layout-sw320dp.... public class Main2Activi...
ashim
1

votes
1

answer
1.4k

Views

spinner not selecting first item

here's my code Spinner agegroup; public void generateAgeGroupSpinner() { final List ageGroup = new ArrayList(); agegroup = (Spinner) findViewById(R.id.ageGroupSpinner); // Spinner click listener agegroup .setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onIt...
Khalid shaikh
1

votes
2

answer
314

Views

Setting up multiple spinners in android

I have 2 spinners in my project and so far only have one spinner working! i am trying to have 2 spinners that when selected change the image in the imageview! the first spinner takes data from an array in the strings.xml and would also like the second array to do the same and update the imageview li...
David Marsh
1

votes
4

answer
2.1k

Views

Opening spinner by clicking on EditText

Sorry to bother you guys, but I've been strangling to get this to work. What I want it to do: EditText to display hint. User clicks on EditText, opens spinner and selects their sex. That then get's turned into a string and put inside the EditText(gender) What it is actually doing: "Male" the first e...
ngx311
1

votes
1

answer
606

Views

spinner if item selected again

I created a class file in my package, called NoDefaultSpinner. When I try to use it in my Android app, though, I get an exception that crashes the program. I copied the code provided by Dimitar Vukman and Blundell from this link and then updated this code as Alex Miragall instructed some posts down...
user1956641
1

votes
3

answer
846

Views

Android: how to give alternate colors to the spinner items

I have a spinner with the items as below ArrayAdapter arrayadapter = new ArrayAdapter(activity, android.R.layout.simple_spinner_item, messages); arrayadapter.setDropDownViewResource(R.layout.textview); i want to give altenate colors to the listitems.how can i do that.Any help is appreciated
teekib
1

votes
2

answer
1.9k

Views

Android spinner crashing when clicked on

I have a spinner on my page, which is populated using an arrayAdapter. When i launch my app everything is ok, but the moment i click on the spinner, the app crashes and logcat gives me no reference to a line in my code. Here is the area of the code referring to the spinner: profiles = (Spinner) find...
arielschon12
1

votes
1

answer
4.3k

Views

Error inflating Spinner

I'm trying to create an UI that contains a Spinner. Here is the XML (the spinner is almost to the end): Now, when I'm trying to start the activity, on inflating this layout the app crash and the error is: Binary XML file line #105: Error inflating class android.widget.Spinner What is the reason?
Daniele Vitali
1

votes
1

answer
1.9k

Views

Populating Spinner with JSON in Android 4.2 using AsyncTask

I am currently trying to translate the code for the MainActivity of an app that I created in API10 into API 16. From what I have read, I have to start using ASyncTask to access a URI and display the information on my app. I managed to do that in 2.3, but after translating it to JSON, I am now facing...
cmnunis
1

votes
1

answer
1.2k

Views

Different dropDownListViewStyles for different spinner styles

In my application theme I have dropDownListViewStyle and spinnerStyle for whole application. But in one fragment I need spinner with custom styled dropDownListViewStyle (I need to change divider). Is it possible to have spinner with other dropDownListViewStyle then is set in theme? In spinner style...
koso
1

votes
3

answer
2.3k

Views

Closing dropdown in Spinner in Android

I need to animate an icon of an arrow when opening and closing a spinner in Android. I can rotate the arrow when opening the spinner: I just put a setOnTouchListener on the Spinner. The problem comes, when the dropdown is closed, or hidden, because I don't know how to set a listener or something lik...
noloman
1

votes
2

answer
289

Views

Android: populate a popup spinner

I'm new to Android, and I'm struggling with this problem: I want to have a popup spinner populated with elements from one of my arrays. The code in the main activity is: AlertDialog.Builder adb2 = new AlertDialog.Builder(this); LayoutInflater adbInflater2 = LayoutInflater.from(this); View SpinnerLay...
user2748484
1

votes
2

answer
8k

Views

setting multiple values to spinner in Android

I can populate more than 1 spinner in Android with multiple values. I want to display more than 1 value in spinner i.e In "0" position (spinner index) I want to set more than one value as per the user dynamically. When user select the first value that will set in 0 position and when user click th...
android learner
1

votes
1

answer
2.1k

Views

add Spinner to action bar in Fragment in Android

Could any one tell me, how to add Spinner to action bar in Fragment ?
kavie
1

votes
4

answer
77

Views

Properly implementing/initializing lots of new variables, taken from RadioGroups and Spinners

I am developing a simple questionnaire-like app which includes lots of radio buttons joined into groups and spinners. I have multiple activities (6); some of them having RBs and some Spinners to let the user answer the questions. The following step, which I have trouble with, is how to fetch lots of...
alkra_dev
1

votes
2

answer
2.8k

Views

Populating TextView With Spinner Selected Item - Android

I wish to set the string content of a TextView object from the selection made in a dropdown Spinner (they are needed as labels and will change often). For now I am just tring to get two working. I have declared the fields and done the FindViewById on each. The App runs perfectly and displays the spi...
SteveK
1

votes
2

answer
951

Views

How to give position zero of spinner a prompt value?

The database is then transferring the data to a spinner which I want to leave position 0 blank so I can add a item to the spinner with no value making it look like a prompt. I have been going at it all day. FAil after Fail MainActivity public class MainActivity extends Activity { Button AddBtn; Ed...
Eugene H
1

votes
1

answer
1.3k

Views

Spinner's background image appears stretched

I have created a dropdown spinner with a background custom image. I have placed the spinner in a linear layout and I have aligned items using weight. Here is my code - XML - Java - int firstC = 0; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceSt...
Confuse
1

votes
3

answer
2.8k

Views

Clear the selected value from android spinner

Once the check box is check then the spinner will be show and once the check box is unchecked then the spinner will be hidden. I have shown that combination in the below image. I have achieved this using below code I have shown. halfHalfCB.setOnClickListener(new View.OnClickListener() { public voi...
modabeckham
1

votes
2

answer
103

Views

Issue with Spinner in the Listview

I have a button and Spinner in ListView item. I've put the below code inside setOnItemSelectedListener of Spinner. String val = viewHolderItem.spinnerSize.getSelectedItem().toString(); shoeList.get(position).setSelectedSize(Integer.parseInt(val)); But it doesn't change inside the setOnItemSelectedLi...
chathura
1

votes
3

answer
1.6k

Views

Android MaterialDialog Spinner

I'm using MaterialDialog.Builder to show a dialog. I set a customView for my dialog. In my layout i have a spinner and i want to populate it form my sqlite database when i show the dialog. The callback function only works when i push those buttons. Is there a function that i can use before dialog s...
Huliganul
1

votes
1

answer
843

Views

setOnItemSelectedListener error when using 3rd party library's spinner

I'm using (github.com/rey5137/material) library. Before I used it I had an activity where the user selected options from spinners. It worked fine and I wanted to use his spinner instead. I ran into one problem. When I call setOnItemSelectedListener, I get this error message in the editor setOnItemSe...
maxib7
1

votes
1

answer
502

Views

Spinner with parse.com

I want to get a list from parse.com and set it to a spinner that I have created I have already used this code but it returns items in the spinner in this format [email protected] final Spinner country = (Spinner) findViewById(R.id.schoolSelect); ParseQuery query = new ParseQuery("schoo...
Mohamed Sherif
1

votes
1

answer
5.2k

Views

How to implement material design spinner

As the Google developer shows material design spinner should be like this But in my AppCompat theme, when I drag and drop a spinner, it becomes like this There is no bottom border or the little triangle in the corner. How do I achieve the one shown the Google developer website?
1

votes
3

answer
3k

Views

How to add space between custom spinner items?

I've followed this tutorial Android Widgets: Custom Spinner in Android and made a custom Spinner that has an image and a text view as items, but for some reason there is no space between the items. At the moment it looks like that when it's not clicked (which is fine): And when I click it, it looks...
Apostrofix
1

votes
4

answer
1.2k

Views

How to set initial text in spinner instead first item of json response

I am using json parsing in my app,i am getting country name from json,the issue is in my json response first country is "Andorra", but by default i want to display "Select Country",following is my json response and code,can any one help me with this?? [{"user_status":"1","country_id":"1","country":"...
albert
1

votes
3

answer
766

Views

load data from JSON ArrayList into spinner

I can't seem to figure this out, since im just a beginner with this android stuff. My app gets the customer names from my WebAPI via JSON. Now I am trying to load it into a spinner, but how can I load my JSON arraylist in there? I tried loading custTable in it but its shows "com.jetron.jetronbuitend...
Yoshi
1

votes
5

answer
14k

Views

Android Spinner validation

I need to validate selected item of Spinner in Android. I tried the following code, but it's not working. if (Spinner1.getSelectedItem().toString().trim() == "Pick one") { Toast.makeText(CallWs.this, "Error", Toast.LENGTH_SHORT).show(); } What is wrong with the code, and how can i fix it?
comex
3

votes
1

answer
3.7k

Views

The checkbox and textview with custom spinner in Android

I am having the 7 items in the spinner box. I have created the spinner box with textview and checkbox. I want to do the following logic. Can you please give me any suggestion to do: private static final String[] select_qualification = { "Select Qualification", "10th / Below", "12th", "Diploma", "UG"...
Krishna Veni
1

votes
3

answer
196

Views

Android - Display button with sharedpreference value

I'm currently working in an Activity which saves text from Button1...button8. But it not display text of button.i don't understand. MainActivity=> public void getName(){ SharedPreferences preferences = getSharedPreferences("sample",0); int a=(preferences.getInt("num",0)); String ab=(preferences.getS...
thang
1

votes
3

answer
7k

Views

How to show radio button when click on spinner in android?

I am working on an android project i want to show spinner data with radio button please suggest how can i do this. This is my code Spinner spinner = (Spinner) findViewById(R.id.sMonth); spinner.setOnItemSelectedListener(this); ArrayList categories=new ArrayList(); categories.add("Month"); categories...
Noman Malik
1

votes
3

answer
9.2k

Views

How to update data in Spinner Dynamically in Android? [duplicate]

This question already has an answer here: How to update a spinner dynamically? 10 answers i have added my data in array.xml file and link to ANDAMAN NICOBAR ISLANDS ANDHRA PRADESH ARUNACHAL PRADESH i want to change this entries dynamically thanks in advance ..
2

votes
1

answer
411

Views

How can I compare a string value with string from spinner?

I am comparing a string value from selected string value from spinner. However, even if the string that I am testing is the same string value from spinner it always return false. I have tested different ways, simplifying the conditions and it always ends the same. The printed value in the log is the...
Joden
2

votes
1

answer
4.2k

Views

Spinner showing items as Drop Down List

I have made a spinner in an activity getting called inside a tab layout. The problem is that the items (3 in nos.) are being showing in a separate dialog as in case of a drop down list and not as a spinner. I followed this example. And as shown the picture I was expecting but I am getting this: thi...
beerBear
2

votes
1

answer
583

Views

Spinner Android Showing different display in Different sdks

I have a simple spinner code,In my PC Android API is updated to lollipop and my colleague PC its kitkat,But the UI is Display like below,Why this happen Lollipop Kitkat activity.xml Style.xml @style/mySpinnerItemStyle @style/mySpinnerItemStyle 15sp #00ff00
appukrb
13

votes
2

answer
14.2k

Views

Combine Spinner and AutoCompleteTextView

I am asking myself if it is possible, to combine a Spinner and a AutoCompleteTextView. Basically I want an AutoCompleteTextView, that shows all entries from Array when I click it. Does anybody know how to do that?
user2710805
17

votes
2

answer
2.9k

Views

Spinner inner padding is larger on Android 6.0.1

Intro: With the new release of Android 6.0.1, seems like Android made some changes on the Spinner component because by default, the inner padding around the down carrot is a bit bigger. I noticed this on an app where I haven't modified anything in the code, but simply updated the OS on the device an...
Mike
17

votes
1

answer
24.5k

Views

Create a spinner programmatically android

I want to create a spinner without using xml. I am new in android and my knowledge is limited. By now i have this code (see above) and i want my spinner in on of the tabs of my TabActivity. There is no obvious error but whene i open my activity the tab is empty. I would appreciate some help. public...
MavrosGatos
1

votes
2

answer
1.5k

Views

Best way to grab focus for Android Spinner

First off I am kinda new to Android, so with that being said. So I have a spinner, and every time I make a selection the phone will scroll back up to the last edit text who has focus. That is very annoying so I set the spinner as focusable, but for some reason I then have to click the spinner twice...
Maroon5Five
17

votes
2

answer
26.9k

Views

Change Spinner DropDown width

I need resize this part size to full display. How can i do this? My adapter: String[] navigations = getResources().getStringArray(R.array.actionBar); ArrayAdapter adapter = new ArrayAdapter( getBaseContext(), R.layout.custom_spinner_title_bar, android.R.id.text1, navigations); adapter.setDropDownVie...
WOLVERINE

View additional questions