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 8512039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:10:23+00:00 2026-06-11T04:10:23+00:00

I have a listview embed in a spinner within the onCreate method. I want

  • 0

I have a listview embed in a spinner within the onCreate method. I want to fire a toast msg on the list items on click event but can’t set up the onClick listener on the ListView items. I’m not using any custom adapters. I guess the same type of simple adapter is used for both the spinner and the listview therefore it generates some compiling frustrations.

I keep focused on the error obtained for "lv.setOnItemClickListener(new AdapterView.OnItemClickListener” :

The type new AdapterView.OnItemClickListener(){} must implement the
inherited abstract method
AdapterView.OnItemClickListener.onItemClick(AdapterView, View, int,
long)

How to manage to setup that click event on the listview items keeping using simple adapters ?
Shall I somehow “rename” the listview adapter or how to proceed then .. ?

Pseudo code

// ...
import android.widget.AdapterView;
/* manually added */
import android.widget.AdapterView.OnItemClickListener;

public class MyActivity extends Activity {

onCreate(Bundle savedInstanceState){

// ... some code
        // Set Spinner listener
        mySpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

            @Override
            public void onItemSelected(AdapterView<?> spinner, View v, int position, long id) {

// ... some code


                    lv.setOnItemClickListener(new AdapterView.OnItemClickListener()) {
                        public void onItemClick(AdapterView<?> parent, View view,int position, long id) {
                                // When clicked, show a toast with the TextView text
                                Toast.makeText(getApplicationContext(), "some msg" , Toast.LENGTH_SHORT).show();
                            }
                        });

}

}
  • 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-11T04:10:24+00:00Added an answer on June 11, 2026 at 4:10 am

    So I have a spinner and a list view in the same activity. Based on the spinner selection, I update a listview. I also update the same listview from other events like button events for example. The code principle is as described in the question.

    I confirm this way works perfectly and I solved my problem that had ntg to do with the spinner/ListView interactions but with the way I fetched data to feed the list.

    To illustrate a bit the result, my layout looks similiar to this but with buttons additional to the spinner, both of them driving the listview result.

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

Sidebar

Related Questions

I have a list that I want to embed within another list. However, jQuery
I have listview with some listadapter after click on item from list I'd like
I have listview which has 5000 items. I want to get item of listview
Hello I have ListView with list of files. i click item and start to
I have ListView (vsReport) and StringGrid and what I want is if I click
I have ListView with about 30 items. When I click on an item, some
I would have listview and a lot of items inside. I want that user
I want to have one ListView that when I click on the item the
I have listview control.There is an option to remove selected items.After the user removes
I have listview having customized some textview and one imageview. When I long click

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.