FAQ Database Discussion Community


snooze functionality using spinner

android,android-activity,android-spinner,android-alarms
I am developing snooze functionality for alarm app, i am using spinner for selecting snooze mins, by default it is selecting as first array int value, but alarm is not rising on snooze time. by default it should not select any value, user need to select. is there any other...

Set default selection for a spinner

android,spinner,android-spinner
I know this is probably a relativity simple question, but I seem to be overlooking the answer. In my app, I have a spinner for the user to select the state that they live in. Currently, the app will be focusing on a local audience so I would like to...

how to get associated other json value in spinner when an item selected

android,json,spinner,android-spinner
I am trying a simple app where I populating a spinner with the values (json value) I got from network call. But I am not getting how to get the associated json value, when an item selected from the spinner. Can any one provide me a article/reference on how to...

Android spinner- weird ui issue

android,android-spinner,android-5.0-lollipop,appcompat
I am using android spinner to show drop down options and i have customized its style and item style. It works fine but on lollipop it shows shadow like shown in the screenshot. spinner style is extended from the appCompat as below <style name="spinner_style" parent="Widget.AppCompat.Light.Spinner.DropDown.ActionBar"> and setting these properties <item...

Android:How To set set deafult value of Spinner?

android,spinner,android-spinner
I am creating a Dropdown(spinner) in which all days have to shown,but i want to set different Default value.Presently default and first value of spinner are same..Please help me how to do this...Code snippets are appreciated.... My is => public class MainActivity extends Activity implements AdapterView.OnItemSelectedListener { Spinner spinner; @Override...

populate custom spinner from strings xml array

android,android-spinner
I have a custom spinner which is replacing my default spinner which was populated by hard coded values in my strings xml. I have used my custom spinner and populated it dynamically in java but i don't need to do this for this one. Do i have to populate a...

custom spinner with colored dropdown image

android,spinner,android-spinner
I am working with custom spinner. I am struggle on this. How can I get the spinner like this ? Note : I have the red color image....

How does Android do its spinner style with the triangle icon in the corner?

android,android-spinner
I've spent way too much time researching this, but I'm wondering if anyone can provide any insight to how Android does its spinner styling with the triangle dropdown indicator? The reason I want to know is that I am using a custom textview as spinner item, and once I use...

Spinner setAdapter returning Null Pointer Exception for my custom adapter

java,android,android-spinner
I am trying to implement a spinner with a custom adapter. However the setAdapter is returning NPE. I've tried doing all sorts of things, including going trough such discussion posts in stack Overflow. Please don't give me a link to a similar answer. I have of course gone through each...

Android - Spinner setting TextView visible/invisible

java,android,android-spinner
I'm trying to do my first Spinner, and I have encountered some difficulties, such as that I don't know if I can get an option by spinner.getSelectItem == "some string". Take a look at my code so far Populating the spinner: public void addItemsOnSpinner() { Spinner buttonSpinner = (Spinner) findViewById(R.id.buttonSpinner);...

android: add unique tag or id for spinner view

android,spinner,android-spinner
I create 4 spinner views in my application, when I change the selected item on one of them I want to know which one of spinners is selected and changed. I use this code : for(int i=0;i<4;i++){ final Spinner spinner= new Spinner(context); ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<String>(context, android.R.layout.simple_spinner_dropdown_item, spinnerArray); spinner.setAdapter(spinnerArrayAdapter);...

android studio - how to add spinner to popupwindow in service

java,android-studio,android-spinner
i've some kind of problems here !! i've code that shows a popupwindow from my service and inside this popupwindow there is a spinner and when i click the spinner the errors start to show off on me :'( here is the code used : final LayoutInflater inflater = (LayoutInflater)...

Storing retrieved contacts phone in to database as a string

android,android-spinner
I am fetching the list of contacts from phone. I am trying to store the selected contact to the database since I want to retrieve the same later. I am trying to store it as a string. I am using spinner to display list of contacts. But the database is...

Getting numerical value of spinner selection for use in calculation

android,android-spinner
I have a spinner for Period which contains the selections: 3 months 6 months 10 months 12 months 18 months PROBLEM: I can get the value of the spinner selection but I need a way to get just the numerical value of the selection ( i.e. just the 3 from...

Binding data from ASP.NET webservice to a spinner in Xamarin

android,asp.net,web-services,xamarin,android-spinner
I am currently experimenting with Xamarin Free and am trying to hookup with my webservices (ASP.NET) to populate a spinner. What I am trying to do is asyncronously call the service and then once the result is returned, populate the Spinner. What happens is, only one single item is bound...

Android - Remove Spinner Dropdown Arrow

android,android-layout,spinner,android-spinner,android-selector
I'm just wondering if it's at all possible to simply remove the dropdown arrow for a spinner? I have a drawable arrow in a backgroud layout for my spinner, however the system default arrow appears to the right of the spinner, which I would like to get rid of. Here...

How to open different activities on item selected on drop down menu on the toolbar

android,drop-down-menu,android-spinner,onitemselectedlistener
I have searched for this over the internet and haven't found appropriate answers. I am loading a spinner drop down menu on my toolbar which contains items that open different activities after being selected. So far I have been able to create a toast which returns the name of the...

Application auto shuts after getting spinner item and calculating

java,android,android-spinner
Whenever i press the button to calculate, the app auto shuts. It is likely due to the spinners(i have a separate app to test the other fields without spinner), is the method of getting the item from spinner and using it in a condition correct? Any help is appreciated! MainActivity...

Android: for loop through EditText, CheckBoxed and Spinners to setErrors

android,for-loop,android-textview,android-spinner
This piece of code gets resources from a list and set errors for each field on a registration form, one of them is a spinner, so when the error is on the spinner, it fails due to the fact that the spinner is not a subclass of TextView. How can...

Android Spinner's onItemSelected executed twice when going back to Fragment

android,android-fragments,android-spinner
I created a spinner for my Fragment that populates it with data retrieved from an HTTP callout. When the Fragment is first created, I populate the spinner with its selection choices, set its setOnItemSelectedListener and set its initial selection in onCreateView(). stateSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView<?> parent, View view,...

Select One Option inside Spinner with results of a SELECT?

android,android-spinner
I'm looking for one way to insert text "-Select one option-" inside a Spinner. I have a select in sqlite that return some results and I do display these results at spinner. How could I do display "-Select one option-" with my results ? Spinner Spinner spin = (Spinner)findViewById(R.id.mySpinner); ConsultaClienteVendaProdutoListAdapter...

Set value for Spinner with custom Adapter in Android

android,dynamic,android-arrayadapter,android-spinner
I am developing a android application with spinner in a form. The spinner items and spinner values are different. I want to collect all the value from the from including spinner and set a rest api service to web back end. here is the response array. {"Status":true,"errorType":null,"countryList":[{"Code":"US","Name":"United States"},{"Code":"CA","Name":"Canada"},{"Code":"AU","Name":"Australia"},{"Code":"GB","Name":"United Kingdom"}]} I...

Android spinner, setting error on specific item

android,android-spinner
How do I set an error when a specific item is selected on my spinner. Let's say my spinner has 0, 1, 2, 3 in it and I want it to error only when 0 is chosen and prompt the user to select something else. Is it possible, if so...

Dynamic Allocation of Array doesn't work for ArrayAdapter while assigning it for Spinner in Android

android,android-arrayadapter,android-spinner,dialogue
I am really facing a problem here to create a Spinner widget in Android. The goal is to populate a Spinner with data that i will dynamically retrieve from a source. Now I am able to create a spinner with a data source that is implicitly declared in the program....

Hi! how can i go into the layout which i selected from the spinner?

android,android-spinner
I have three options to choose from the spinner, if i choose (e.g: "choose mode") and click the next button to send me in to the layout i selected, and so on, i' m thinking to use switch cases, but i don't know how to do it exactly public class...

Android Spinner different View for Spinner not items

java,android,android-spinner
Is there anyway to set different layout for Dropdown Spinner View itself not its items ?! I mean I know that we can set layout for Dropdown Spinner items by inflating custom layout using getDropDownView in Spinner ArrayAdapter , but it changed view of the rows not spinner dropdown view...

How create a custom Spinner toolbar dropdown in android

android,android-fragments,android-spinner
I need to add a custom Spinner drop-down to my action bar.In main-activity I'm using following code. private Toolbar mToolbar; private Spinner mToolbarSpinner; private List<SpinnerNavItem> mToolbarSpinnerNavigationItems; private BaseAdapter mArrayAdapter; mToolbar = (Toolbar) findViewById(R.id.toolbar_actionbar); setSupportActionBar(mToolbar); getSupportActionBar().setDisplayShowHomeEnabled(true); getSupportActionBar().setDisplayShowTitleEnabled(false); /*Setup a Spinner*/ mToolbarSpinner = (Spinner)...

Android set items into Spinner by custom Adapter

android,android-spinner
in my application i have custom BaseAdapter for Spinner for insert data from List into that, in this method i can return List as an data: public List<String> getSmsNumberList() { return Arrays.asList(smsNumbers.split("\\s*,\\s*")); } after geting successfull data from that i'm prepare to insert into Spinner: smsNumbers = G.getInfo().getSmsNumberList(); panel_numbers =...

Passing a parameter to spinner in android

android,android-spinner
I have 2 spinners and first loading the values to the 1st spinner from the json response. Then select a value from 1st spinner then selected value from 1st spinner will be send to a method another method called getFilteredDescriptions() and it returns a ArrayList() called resultDescription. I want to...

Applying OnFocusChangeListener and OnItemSelectedListener to Spinner

android,listener,android-spinner
I have a spinner that works fine with the standard OnItemSelectedListener to present a set of options: s.setAdapter(adapter); s.setOnItemSelectedListener(new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> arg0, View arg1, int selectedPosition, long arg3) { if (selectedPosition == 0) { // do stuff } else { // other stuff } } public void...

Android spinner not displaying items

android,android-spinner
I was working with android application and a simple spinner is behaving like a freak. I am trying to populate a spinner dynamically, and the spinner simply doesn't show me the list of the elements. All I see is the first element selected in the spinner. private String[] cSpinner; @Override...

Even though item is not selected OnItemSelected is getting triggered in Spinner

android,android-spinner
I have the following code for the spinner. I am not getting any errors and spinner is working but I am having a problem with this even though I have not selected any item, the code inside the onItemSelected listener is getting executed, but I do not want this to...

How to check a spinner which contains a string is not equal to another string?

android,equals,android-spinner
How to validate many spinners,which intially contains string select.If it is changed,then only validation must execute.Otherwise have to display some message. if(!(spnVehType.getSelectedItem().toString()) .equals ("Select")|| !(spnVehType.getSelectedItem().toString()).equals("اختيار") && !(spn_bodytype).equals("Select")|| !(spn_bodytype).equals("اختيار") && !(spn_veh_make).equals("Select")|| !(spn_veh_make).equals("اختيار") && !(spn_veh_model).equals("Select")||...

ActionView/Spinner with match_parent in action bar

android,android-actionbar,android-spinner
I need spinner in Action Bar for filtering content, looking something similar to this: But spinner should fill full length of action bar. What i tried: 1) actionBar.setListNavigationCallbacks(navigationAdapter, this); Yes, it works. But i need this filter only in 1 fragment. Yes, i can use ActionBar.NAVIGATION_MODE_LIST only in this fragment,...

Spinner with arrow in left

android,android-spinner,right-to-left
I'm developing an app for RTL language and want to change the position of arrow to the left of Spinner ! Is there anyway to do this without creating a custom spinner ?

How to review the selected item on spinner

android,android-spinner
Here is my code for my spinner.. i want it to save to my database by using setText but theres no option for setting it into setText.. this is how i want it to save on my database spinpstat.setText(student.status); this is how i want it to declare in my onClick(View...

How to get list of data from database to spinner

android,sqlite3,android-spinner
I want to get all username from my user table to be displayed in my spinner for selection but instead of displaying all username from my list it displays only one which is the first user from my database.. how can i get all username? String q = "SELECT *...

Strange Behavior when populating Spinner from Databse

php,android,json,android-spinner
i am trying to populate a spinner from Mysql Databse through JSON. The thing is that the data are exported fine. But when i click the Spinner to show the dropdown menu the app crashes. The JSON output from database: Output The Error: 03-01 18:12:42.966 3214-3214/com.order.app.order E/ArrayAdapter﹕ You must supply...

Customize the spinner in Android is giving space issue

android,spinner,relativelayout,android-spinner
I have customize the background of the spinner. I have removed the background and showing a spinner down arrow beside that. But if the text are not properly aligned. The bigger length text is showing in complete area but for smaller text, there is a gap coming for text and...

Spinner adapter issue in Android 5.0

android,android-5.0-lollipop,android-spinner
My app is not compatible with Android 5. When I run it in any other version it works with no issues. This is what appears in the logcat when run it in Android 5: 05-16 23:44:10.287 1969-1969/com.barakah.camel E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.barakah.camel, PID: 1969 java.lang.IllegalArgumentException: Spinner adapter view type...

Android Spinner different arrow color

android,android-spinner
1) I have strange behavior with Spinner. If i add it to Action Bar with ActionBar.NAVIGATION_MODE_LIST. ArrayAdapter<CharSequence> barAdapter = new ArrayAdapter<CharSequence>(mContext, R.layout.projects_filter_item, android.R.id.text1, mContext.getResources().getStringArray(R.array.projects_filteres)); barAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); getActionBar().setListNavigationCallbacks(barAdapter, mOnNavigationListener); getActionBar().setDisplayShowTitleEnabled(false);...

Spinner drop down popup position changes in Nexus 5 (android 5.0)

android,android-spinner
I am using a Spinner in my app. I used the basic spinner and this is my code:` android:layout_width="match_parent" android:layout_height="match_parent" style="@style/SpinnerSpinnerTheme" android:spinnerMode="dropdown" android:layout_gravity="center_vertical" android:id="@+id/hj_order_date_spinner" />` and this is how i instantiated in my activity ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,R.array.hj_spinner_items,android.R.layout.simple_spinner_item);...

Spinner object doesn't take second input once a process is being executed

android,android-spinner,yahoo-finance
I am working on a finance app where i am populating the exchange currecny value using the Yahoo Finance Api and here is my implementation void currency_widget() { from.setAdapter(new CurrencyListAdapter(getActivity(), R.layout.country_list_item, recourseList)); from.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { String m =...

Custom spinner drop-down showing data from bottom first time

android,custom-controls,android-spinner
I have create a spinner and set data using custom adapter. In that case, If I click on spinner I am getting drop-down which start from bottom. I need that drop down start from top. I am getting this issue as shown in image As shown in image Data getting...

setOnItemSelectedListener is not working when dynamically filling items in spinner

android,android-spinner
What I am are trying to do is:- To show states in spinner load it from database and fill the spinner. on selection state, depending on state, the city must be filled in another spinner. What I achieved is: Spinner get filled with the values from database, but the setOnItemSelectedListener...

Spinner with Select One throws IndexOutOfBoundsException?

android,android-spinner
I'm trying insert in my BaseAdapter of a Spinner the text: "Select one option". The problem is after insert this text my spinner stop works and throws an exception IndexOutOfBoundsException. How could I solve it ? Spinner Spinner spin = (Spinner)findViewById(R.id.mySpinner); ConsultaClienteVendaProdutoListAdapter adapter = new ConsultaClienteVendaProdutoListAdapter(this, lista); spin.setAdapter(adapter); BaseAdapter public...

spinner fatalexception: asynctask #2 an error occured while executing doInBackground()

android,json,android-asynctask,android-spinner
i create chain spinner that get data from server and return it by json. my firts spinner is fine. in second spinner the json give response but when try to save the renspone in array the asynctask error caused by nullpointerexception. when i check it in log cat there is...