spinner

What is the right way to communicate from a custom View to the Activity in which it resides?

谁说胖子不能爱 提交于 2019-12-28 13:46:10
问题 I have a custom View class that extends Spinner. I'm trying to figure out what the correct way to talk to the Activity that it's embedded in is, when the user makes a selection. I see that the OnItemSelected listener gets a reference to the Adapter, but I'm not clear on whether or not I should be using this adapter and walking up its parent chain somehow, or if I should just talk directly to the context (for some reason that doesn't feel safe, even though I can't think of a way in which it

How to add a Hint in spinner in XML

家住魔仙堡 提交于 2019-12-28 02:49:04
问题 I am trying to add a Hint in the spinner widget as there is no option of Hint as in EditText , I want to show Gender as a Hint and when clicked it must show only Male and Female not the hint. How it can be Done Only Using XML XML code of spinner. <Spinner android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/spinner1" android:entries="@array/gender" android:layout_marginTop="10dp" android:layout_marginLeft="25dp" android:layout_marginRight="25dp" android

Multi selection spinner in android without AlertDialog

房东的猫 提交于 2019-12-27 11:46:52
问题 i want the same as this link https://www.gorecess.com/ first spinner . multi selection spinner in android with checkbox .Show the spinner in dropdown. anyone know answer... 回答1: <com.extra.MultiSelectionSpinner android:id="@+id/input1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margin="2dp" /> MultiSelectionSpinner spinner=(MultiSelectionSpinner)findViewById(R.id.input1); List<String> list = new ArrayList<String>(); list.add("List1"); list.add(

Multi selection spinner in android without AlertDialog

a 夏天 提交于 2019-12-27 11:45:52
问题 i want the same as this link https://www.gorecess.com/ first spinner . multi selection spinner in android with checkbox .Show the spinner in dropdown. anyone know answer... 回答1: <com.extra.MultiSelectionSpinner android:id="@+id/input1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margin="2dp" /> MultiSelectionSpinner spinner=(MultiSelectionSpinner)findViewById(R.id.input1); List<String> list = new ArrayList<String>(); list.add("List1"); list.add(

Android array list from database

爱⌒轻易说出口 提交于 2019-12-25 14:49:19
问题 I wanna create an array of cities that are stored in the database Cities Table CREATE TABLE cities (_id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT); Querying for City List // City List public Cursor cityList() throws SQLException { return db.query(TABLE_CITIES, new String[] {ID, KEY_NAME}, null, null, null, null, null, null); } Trying to Get the content into the Array Cursor cities = db.cityList(); startManagingCursor(cities); String[] city_list = new String[] { DBAdapter.KEY_NAME };

Spinner Items Not Clickable

旧城冷巷雨未停 提交于 2019-12-25 08:00:10
问题 I have a spinner that i fill with 4 elements. During startup onItemSelected method gets executed correctly and the toast message is displayed. However when i open the spinner and try to click any item, no event is called and the spinner popup will not close unless i press the spinner arrow. In other words I can not interact with spinner items. Below is the activity code for the spinner <Spinner android:id="@+id/spinner" android:popupBackground="@color/red" android:clickable="true" style="

Cannot see selected text android AppcompactSpinner

橙三吉。 提交于 2019-12-25 06:47:35
问题 I have put an app compact spinner in my application. I am unable to see the selected text(I think this is because the colour of the selected text becomes white, i.e same as the background colour). I am able to see the text in the dropdown. support-design - 23.3.0 minSdkVersion: 15 targetSdkVersion 23 My Spinner code <android.support.v7.widget.AppCompatSpinner android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/university_spinner"> </android.support.v7

Adapter for a spinner makes NullPointerException

巧了我就是萌 提交于 2019-12-25 06:38:46
问题 I made an array list in one of my value's folder, now when i want to adapt it to the spinner by retrieving it from the source folder it says NullPointerException : spinner = (Spinner) findViewById(R.id.spinner); ArrayAdapter adapter = ArrayAdapter.createFromResource(this,R.array.worker,android.R.layout.simple_list_item_1); spinner.setAdapter(adapter); spinner.setOnItemSelectedListener(this); Messages in LogCat: Caused by: android.content.res.Resources$NotFoundException: String array resource

My Spinner Widgets look different on different devices. How can I define a own Spinner that looks the same on all handsets?

好久不见. 提交于 2019-12-25 05:48:09
问题 I use this code to generate a spinner in my app: subCatAdapter = new ArrayAdapter<Subcategory>(this, android.R.layout.simple_spinner_item, subCategories); subCatAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); On my device (Motorola Milestone) and in the emulator this looks like the standard gray spinner widget. On of my colleagues uses a Motorola Backflip and on his device the Spinner is black. Now its very hard to read the font in the spinner. What do I have

Update a spinner in Android

若如初见. 提交于 2019-12-25 04:57:30
问题 In my application I have 1 spinner option. In that I am displaying 6 values (which is array from values file). Now in that when I click its 5 items of the spinner value the selected item will show in the spinner in the activity screen. When I select 6th item in spinner I have to start a new activity. Is it possible? Do I have to do this by position value? Also in the new activity (after selecting 6th item) I have 5 edittext values in which user can enter a string which should replace the old