Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7747849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:37:56+00:00 2026-06-01T10:37:56+00:00

I am experiencing a odd problem. My OnItemSelectedListener seems only works one time, i

  • 0

I am experiencing a odd problem. My OnItemSelectedListener seems only works one time, i mean that it shows my test Toast at the first time when clicking the coresponding items, but it doesn’t show the test Toast when i hit the same item at the second time.( it does work when clicking a different item at the second time) What is the problem? plz help me

partial code is here

        //get task object from menu
    taskListArr = new ArrayList<Task>();

    taskListArr = getCurrentTasks(taskListArr);

    myTask=new TaskListAdapter(this, 0, taskListArr);
    ArrayAdapter<String> aa = new ArrayAdapter<String>(this,
            android.R.layout.simple_spinner_item, TaskModel.sorts);
    aa.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    sortSpinner.setAdapter(aa);
    sortSpinner.setOnItemSelectedListener(this);



    @SuppressWarnings("unchecked")
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,
        long arg3) {
    if(arg2 == 0){
        Toast.makeText(getApplicationContext(), "1", Toast.LENGTH_SHORT).show();
        Collections.sort(taskListArr);
        taskListView.setAdapter(myTask);
    }
    if(arg2 == 1){
        Toast.makeText(getApplicationContext(), "2", Toast.LENGTH_SHORT).show();
        Collections.sort(taskListArr, new DateComparator());
        taskListView.setAdapter(myTask);
    }
    if(arg2 == 2){
        Toast.makeText(getApplicationContext(), "3", Toast.LENGTH_SHORT).show();
        Collections.sort(taskListArr, new PriorityComparator());
        taskListView.setAdapter(myTask);
    }
    position = arg2;
}

public void onNothingSelected(AdapterView<?> arg0) {

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T10:37:58+00:00Added an answer on June 1, 2026 at 10:37 am

    Check out spinner in android developers site http://developer.android.com/reference/android/widget/Spinner.html

    A view that displays one child at a time and lets the user pick among them. The items in the Spinner come from the Adapter associated with this view.
    

    It selects one child at a time. So Selecting the already selected child again will not invoke onItemSelected function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a bit of unusual problem that I'm experiencing, but recently one of
I've been experiencing this very odd problem lately in Heroku. I develop and test
I am experiencing a problem with a dynamically sizing iFrame. Essentially it works perfectly
We are experiencing an odd problem. We get the KeySet of an Oracle Coherence
Edit: Rolled back Wills change as it was wrong I'm experiencing an odd problem
I'm experiencing something odd here, that I don't recall ever running into. I'm doing
I've got this odd problem. If I make a call on that function through
I'm experiencing an odd problem where my page's SSL breaks in firefox if I
I'm experiencing a very odd problem with a Java application running under Tomcat. We
I have been experiencing a weird problem that I can't find a solution to.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.