Questions tagged [onitemselectedlistener]

Android Interface definition for AdapterView for a callback to be invoked when an item in this view has been selected.

0
votes
1answer
15 views

At second approach, second spinner value is not changing

I have used two spinners for dept and course in which I am setting courses of respective depts. When I try to select department again it is showing respective courses in the second spinner but not ...
0
votes
3answers
41 views

Enable Button when Spinner and EditText are not empty in Dialog

In my AlertDialog, I have a Spinner and an EditText. I am trying to disable the positive button of the dialog if selected item at Spinner is "Select currency" ("Select currency" is the first item in ...
0
votes
1answer
49 views

Calling value from OnItemSelectedListener

I have a value from the selected item in spinner passed to a String variable 'selectedSpinner' using spinner.setOnItemSelectedListener(). I am trying to access 'selectedSpinner' outside of the method. ...
2
votes
1answer
54 views

OnItemSelectedListener in Dialog

I have a spinner in a dialog and I am trying to get the value from the selected item in spinner and pass it to a String variable. The method that I have found was spinner.setOnItemSelectedListener(). ...
0
votes
1answer
28 views

Android Navigation View click listener not working [duplicate]

I created the Activity with the Wizard. I deleted what I am not interested in, for example, the floating action button. Created my custom items in the activity_main_drawer.xml The wizard created the ...
1
vote
1answer
59 views

Update recyclerview single row data when spinner item data is changed

I have a RecyclerView as given in picture below. I get the food item data from the server and bind them to RecyclerView as above. Food items are assigned in foodItemList array list which has ...
1
vote
1answer
34 views

How to get call object methods in ListView onClickListener?

I'm a relatively new programmer. I'm making a ListView, and when one of the items is clicked, two or three separate TextViews (depending on the orientation) should change to one of the variables ...
1
vote
1answer
17 views

Why Android Spinner onItemSelectedListener have two identical params

Can anyone please clarify why onItemSelected() method has both position and id params? First I read the docs and didn't understand the difference. Then I tried watching both parameters in debug and ...
1
vote
3answers
77 views

How can I retrieve data from spinner and process it?

This is the part of my code that went wrong(I omitted all the variable declaration to make it short): I need to create two spinners and retrieve values from them, say value1 and value2. Then I need to ...
0
votes
0answers
15 views

Can I make implements like this for fragment ? I try to make item selection and refresh data on recyclerview

// this is implementation part , I try to make work it right public class ArchivedFragment extends Fragment implements SwipeRefreshLayout.OnRefreshListener, FragmentsAdapter.FragmentsAdapterListener {...
0
votes
0answers
46 views

Two spinner having same array set but different selection of item needs to be enabled

I have the same data set for two spinners, and I want the selected item in spinner1 should not be in spinner2 dataset and selected item in spinner2 should not be in spinner1 dataset. Example: Let the ...
1
vote
0answers
35 views

Manage spinners with same data while performing OnItemSelectedListener in Android

I have 5 spinners. I am using BaseAdapter to set custom row on spinners. I am loading the same data i.e. ArrayList of the model in each Spinner. Now, the problem is, when I select an item from any ...
-1
votes
2answers
119 views

OnNavigationItemSelectedListener starting activity instead of replacing fragment

I am new to programming and I am creating an app with bottomNavigationView. In my Welcome activity I have my OnItemSelectedListener. But when I run the app in an android device and select an option it ...
1
vote
2answers
47 views

OnNavigationItemsSelected Listener is starting the same activity again and again

I am new to Android Development And I am trying to create an application with bottomNavigationView. I have created a separate class to setup the bottomNavigationView for different activities so that I ...
1
vote
1answer
16 views

Is there a way to get the Spinner object that was changed in OnItemSelectedListener?

I have an array of spinners with the same OnItemSelectedListener but I need to know which spinner was selected (preferably where I can get the index of the array) so I can pass it on as the index of ...
0
votes
0answers
52 views

Issue while using contextmenu with listview items in a popupwindow

I am developing an android application, my proposal is have two clickable textviews on the page and when user press each of the textview, a listview in a popupwindow will shows under the textview, ...
-2
votes
2answers
342 views

one item clickable in RecyclerView in android

i'm working on some kind of educational game, in this game i represent nine levels in recyclerview each level is enabled when the previous one, now i'm trying to make one item in the recycler View ...
0
votes
2answers
41 views

Item in NavigationView remains disabled (onNavigationItemSelected)

I have a list of items as follows: (act_pedido_drawer.xml) <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="...
0
votes
0answers
61 views

OnItemSelected returns null

I'm trying to get the selected value from a spinner as a string, but always get "null" for both language_choice and translation_choice (even though I can see the actual values when choosing them in ...
0
votes
1answer
68 views

How to pass selected spinner id to fragment

Hello I am newbie and developing android application. Pardon my english. In my App I have MainActivity.java file, in which I am parsing Languagelist Array using json parsing. I send it to next ...
0
votes
1answer
140 views

How to trim Spinner selection when selected?

I would like to trim the user's selection in Spinner. When the user chooses his country (for example "+232 Sierra Leone") to show only "+232" when the item is selected and the spinner is closed. ...
0
votes
0answers
60 views

Spinner onItemSelected's previous position overrides current position inside Fragment

I have 2 fragments: 1. A fragment containing a List of items. 2. A fragment containing a spinner of the same items. I have to click the list item to go the spinner fragment(sending position from list ...
0
votes
1answer
365 views

Set the adapter to spinner using 3rd party API

I'm using this 3rd party library for searchable spinner. Every thing is good but problem is that when I set the adapter to the spinner so in the drop-down I'm getting object reference instead of ...
1
vote
1answer
86 views

How to add cursor data(DbHandler.java) to listview(MainActicity.java)?

My MainActivity.java code: public class MainActivity extends Activity implements AdapterView.OnItemSelectedListener{ Spinner spinner1; TextView textView; ListView listView; @Override ...
-1
votes
1answer
29 views

do a task based on multiple onItemSelectedListeners

i am using three spinners to get input from the user, and based on this information i will then graph some data. however i cannot seem to figure out how to do this. i have the following code (extract ...
0
votes
1answer
399 views

android - Spinner setOnItemClickListener doesn't accept named class that implement OnItemClickListener as parameter

In my android app, I have a Spinner, and I try to detect when an item is selected. I know this can be done using setOnItemSelectedListener() method, but what I don't understand is that this works ...
0
votes
1answer
426 views

How do I get the spinner clicked item out of the onItemSelectedListener in this fragment?

I have the following code. I want the onItemSelectedListener to put the value of the selected string into store_id for further processing. I've used Toast to examine it because I can't put a watch on ...
0
votes
5answers
508 views

Spinner: getItemAtPosition(position) is returning always null/empty

I wanted to display selected item in the textView when selected from dropdown list of spinner I implemented AdapterView.OnItemSelectedListener but when I'm selecting item its always null/empty here is ...
2
votes
2answers
975 views

Best way to implement ArrayList in Android Studio

i have 30 items in ArrayList and its implement in Spinner, i placed it in java file like this ArrayList<String> listProblemSolving = new ArrayList<>(); listProblemSolving.add("List1")...
0
votes
1answer
366 views

Java onItemSelectedListener and Spinner not returning Anything

I'm building a currency converter (get from API, dynamically fills lists to create available currencies, select two currencies and return the rate. It seems a right of passage exercise). I've been ...
0
votes
1answer
80 views

onItemSelectedListener doesn't get triggered

I am calling onItemSelectedListener in my spinner but the code inside onItemSelected is not being executed. Here is my code: final MaterialBetterSpinner materialDesignSpinner = (...
0
votes
1answer
337 views

Unable to select item from Spinner

I am trying to populate my spinner using a List it works, but when I try to select an item I am unable to do so. I've created a list from a firebase database and I need to use it in a spinner. This ...
1
vote
1answer
307 views

android spinner adapter OnItemSelectedListener what is Row Id

I am working with spinner in android for a while now, and I always use what it says in documentation and I would use parent.getItemAtPosition(pos) to get the Item, or I would use questions like this ...
-2
votes
2answers
52 views

Selecting Spinner Item doesen't trigger onItemSelected - method

I have a settings fragment with 2 spinners in it. I'm not able to execute code written into the onItemSelected-method. There are no errors or exceptions. I searched many similiar questions but none ...
-1
votes
2answers
125 views

FATAL EXCEPTION onItemSelected

My app sends USSD requests. It has an activity from where a fragment is launched which has buttons that launch AlertDialog and USSD requests are sent onItemSelected. Now the force close when I try to ...
-1
votes
2answers
456 views

Spinner onItemSelected does not work

private Spinner spinnerMonth; public View onCreateView(LayoutInflater inflater , @Nullable ViewGroup container , @Nullable Bundle savedInstanceState) { super.onCreateView(inflater,...
0
votes
2answers
137 views

Find other child Views from dynamically created layout

I have a spinner in which when a user picks a value, the onItemSelectedListener opens up a dialog to put additional details private AdapterView.OnItemSelectedListener spinnerListeners=new AdapterView....
0
votes
2answers
235 views

Spinner setOnItemSelectedListener is not invoked

I checked the related questions to this problem and tried some of the suggestion but still it dosen't seem to execute the setOnItemSelectedListener event. Here is my activity code : private void ...
1
vote
1answer
570 views

Android navigation drawer (when clicked) is triggering my OnItemSelectedListener for a spinner in my toolbar

I currently have a Fragment hosted by an activity (which extends AppCompatActivity) layout. This parent activity sets a Navigation Drawer. The activity layout has a Toolbar which hosts a Spinner from ...
0
votes
1answer
150 views

Spinner onItemSelected to clear the EditText Text

I have a spinner on one of my Activity that on initialization will load the data from database for spinner.setSelection(0). When I change the spinner value, lets say spinner.setSelection(1), I want to ...
2
votes
2answers
321 views

How to set the text of a TextView to the content of a selected item on a spinner?

I'm trying to get the value of the selected item into a TextView, and i want it to change each time the selected item change! I've try to get the position of the selected item into a string then set ...
0
votes
0answers
30 views

Reopening Activity from Spinner in Android [duplicate]

In a messaging app, in my WriteMessageActivity, I have a spinner for choosing who can see my messages. I have three options - visible to everyone - my friends only - select friends Now when I ...
1
vote
1answer
497 views

Spinner AdapterView.OnItemSelectedListener not working

I'm using two way data binding on an edit activity, I'm trying to avoid boilerplating and I need to know when the data changed on that activity. I have created a TextWatcher for EditText that works ...
2
votes
2answers
1k views

Avoid Spinner's onItemSelected being called automatically after setAdapter

The Spinner is calling onItemSelected automatically after setting adapter, and I'd like to avoid it without any kind of workaround such as using flags to check if it's the first time; add the listener ...
0
votes
1answer
66 views

How to stop onItemSelected from getting executed when returning from a locked screen

I have just one fragment attached to an activity using replace. When the device locks the screen after a few seconds and then I unlock it, the onItemSelected method assigned to some spinner gets ...
0
votes
3answers
98 views

Android ListView how to update the view on unselected

I have a ListView in which I want to change the selected row to a different color but reset it to the original color when its unselected. I use onItemSelectedListener to set the color, which works ...
0
votes
0answers
307 views

Android spinner item selected default doesn't work

in my app i have develop a filter fragment. In this fragment i have a checkbox with spinner list that if is a item selected he apply a filter on a json. Now this filter works fine if when app start is ...
0
votes
1answer
252 views

Spinner item selection not working and debug flags 'No such Instance filed' error

I used spinner in my app. I am using it to let users pick a color from to change the colors of text view. But the text color doesn't change when I make color selection from the spinner. Can someone ...
1
vote
2answers
587 views

Navigation drawer: how to make the item direct you to a website. Android Studio

Hi guys perfect saturday for some coding :) I have a navigation drawer where i can click on items and they direct me to fragments. But how i make so when i press an item in the navigation drawer to ...
0
votes
0answers
32 views

onclick of 1st button activity it do not wait for 2nd spinner activity directly goes to 3rd activity

spCountries.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> adapter, View v, int position, ...