spinner

Is it possible to use an expandablelistview as a dropdownview for a spinner?

浪子不回头ぞ 提交于 2019-12-10 23:29:17
问题 I have a 2d array of strings. I would like to use a spinner to allow users to select values from the 2nd lvl of the array but I would like to display the selection options in a expandablelistview using the values of the 1st lvl of the array as category headers. Is this possible, can someone point me in the right direction of how this should be implemented ? 回答1: You cannot directly use an ExpandableListView for the Spinner popup, any more than you can directly use a ListView for the Spinner

How to get Value from URL and set name in spinner and send select value id to Server in fragment

两盒软妹~` 提交于 2019-12-10 23:09:39
问题 I am new in android dev i am fetch data from URL and want to set name in spinner and send their id to server MY JSON { "data": [{ "name": "RELIANCE CDMA", "ID": "1" }, { "name": "IDEA", "ID": "5" }, { "name": "AIRTEL", "ID": "7" }, { "name": "MTNL DELHI", "ID": "8" }, { "name": "MTNL MUMBAI", "ID": "8" }, { "name": "VODAFONE", "ID": "12" }, { "name": "LOOP", "ID": "13" }, { "name": "BSNL", "ID": "14" }, { "name": "AIRCEL", "ID": "19" }, { "name": "TATA INDICOM", "ID": "23" }, { "name":

Difference between setAdapter() and setDropDownViewResource() on Spinner

心已入冬 提交于 2019-12-10 22:22:43
问题 I looked at this question Difference between android.R.layout.simple_spinner_dropdown_item and android.R.layout.simple_spinner_item, but couldn't find an answer to my question. I can see that there is a difference between simple_spinner_item and simple_spinner_dropdown_item. But why do I need to set them both? Which part of Spinner layout is controlled by layout set in setAdapter() (simple_spinner_item ) and which one by layout set in setDropDownViewResource() (simple_spinner_dropdown_item) ?

Selecting the currently selected item in a spinner

笑着哭i 提交于 2019-12-10 21:36:19
问题 I have a spinner widget that only has one item by default, "Create new..." My problem is if there is only one item in the spinner list, it's already selected, so clicking on it again doesn't trigger anything. Is there any way to detect when an item is re-selected? Thanks. 来源: https://stackoverflow.com/questions/5201197/selecting-the-currently-selected-item-in-a-spinner

Spinner: NullPointerException at ArrayAdapter.createViewFromResource

人盡茶涼 提交于 2019-12-10 20:14:57
问题 I create some Spinners by code like this : if (dyn_list_id[i]==null){ String[] form_ids = db.getEntireColumn(list_table_name[i], "form_label_id"); String[] spinnerArray = new String[form_ids.length]; for (int k=0;k<form_ids.length;k++){ spinnerArray[k] = db.getFromLanguageTable(language_short_name, list_table_name[i], form_ids[k]); System.out.println("Spinner Array "+spinnerArray[k]); } product_spinner[i] = new Spinner(viewToLoad.getContext()); //First Spinner product_spinner[i]

Android Spinner OnItemSelected ONLY on User Interaction

与世无争的帅哥 提交于 2019-12-10 18:53:59
问题 I know that this question has been answered multiple times, but I have not found any of them satisfactory and certainly not elegant. The issue is that OnItemSelected gets fired not only when the user selects an item, but also when the selection is programmatically set. Some answers propose setting a flag for times when the programmer is setting a value for the spinner. However sometimes other android code will set the value outside of your code. A common place for android to set the value is

Based on a certain spinner selection populate another spinner

北战南征 提交于 2019-12-10 18:35:47
问题 I am currently having an issue with trying to populate a second spinner based on the selection of the first. My first spinner would have something like the following in the drop down: Option1 Option2 Option3 Then there is another spinner below: I only want Option1 to be special, meaning, when the user picks Options1, the second spinner will display: spec1 If the user selects Option2 or Option3 then they display this: spec1 spec2 spec3. You probably see what I'm getting at. Only if Option1 is

Android Spinner OnItemSelectedListener not working accurately

五迷三道 提交于 2019-12-10 18:26:12
问题 I have created a Spinner and activated the listener: customerListSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){ public void onItemSelected(AdapterView<?> adapter, View view, int position, long id) { // I do some work here } public void onNothingSelected(AdapterView<?> arg0) { isInitRadioGroup = false; } ); I have added three values in the Spinner initially: "Search", "Employee", "Company". If the user selects "Search", a new ListActivity is shown and the selected value is

getSelectedItemPosition() of a spinner always returns 0

左心房为你撑大大i 提交于 2019-12-10 17:14:21
问题 I'm trying to make the alert box show the selected item on the spinner and I'll need the position later on the code. I tested and the spiAli.getSelectedItemPosition() only returns 0 even before the switch. Here is my string: private static final String[] listaAlimentos = {"Arroz","Feijão","Bife"}; ArrayAdapter<String> alistaAlimentos; And the function that's not working: butFinalizar.setOnClickListener(new View.OnClickListener() { public void onClick(View arg0) { String escolhaAlimento = null

Items in multiple columns - spinner

瘦欲@ 提交于 2019-12-10 16:47:34
问题 I'm creating an Android app and I want to put a lot of short items to Spinner. Basically, it works: But it doesn't work as I want. As you can see, there is a lot of items which have a very short text. It means that user may be forced to scroll a lot to find an item (s)he want. What I want to do is to put items in multiple columns, but I don't know how to do it. I searched in the internet for a while and the only solutions I've found were "how to put multiple columns in 1 item" - what I want