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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:21:26+00:00 2026-06-12T21:21:26+00:00

I have an app that has a SimpleCursorAdapter. I can get the content of

  • 0

I have an app that has a SimpleCursorAdapter. I can get the content of the DB table to show up in the list but i’d like to do something when the item in the list is clicked. When i go to source in eclipse and try to override a clickListener there is nothing to override. I’m looking for a method to override like onListitemClick. How would i do ths?

Eclipse is also complain about the method onListItemClick, sayimg that it must override or implement a supertype method. If i delete the @Override annotation then that error goes, the list is displayed but no event is fired from touching an item in the list.

private class MyAdapter extends SimpleCursorAdapter {

        public MyAdapter(Context context, int layout, Cursor c, String[] from,
                int[] to) {
            super(context, layout, c, from, to);


        }

        @Override
        public
        View getView(int position, View convertView, ViewGroup parent) {
            Log.e(TAG, "inside myadapter getview");
            View v = super.getView(position, convertView, parent);
            if(v == null)
                return null;

            Cursor c = (Cursor)getItem(position);

            String phoneName = c.getString(c.getColumnIndex(LoginValidate.C_PHONE_NAME));
            String phoneNumber = c.getString(c.getColumnIndex(LoginValidate.C_PHONE_NUMBER));

            ((TextView)v.findViewById(R.id.phonename)).setText(phoneName );
            ((TextView)v.findViewById(R.id.phonenumber)).setText(phoneNumber);
            ((TextView)v.findViewById(R.id.phonename)).setTextColor(Color.BLACK);
            ((TextView)v.findViewById(R.id.phonenumber)).setTextColor(Color.BLACK);



            return v;
        }



    }// end of adapter

    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {

        Log.e(TAG, "clicked an item in list");
    }
  • 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-12T21:21:27+00:00Added an answer on June 12, 2026 at 9:21 pm

    The adapter doesn’t have an onListItemClick() method by default, which is why the annotation is bothering it.

    You have to tie in the onListItemClick() to the listView… try using it by

    ListView list;
    list.setOnListItemClick(listAdapter); //if your adapter implements OnListItemListener
    

    or just like this

    list.setOnListItemClickListener(new OnListItemClickListener()
    {
          @override
          public void onClick(args)
          {
               listAdapter.onListItemClick(args); //you will want this to be the first or the last call here
               //maybe some other stuff if you want here
          }
     }
    

    and that should do it.

    To sum up:

    1) either implement the correct interface in your adapter and it will require the override annotation

    2) leave the method exposed in the adapter and call it from a private onListItemClickListener attached to the listview.

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

Sidebar

Related Questions

I have an app that has a list of items. My customer prefers to
I have an app that has a list as its main activity and then
i have an app that has an inapp purchase. in this store i can
I have implement FragmentPagerAdapter in my app but it show only a same list
I have an app that has settings the user can pick before running the
I have an app that has a ListBox of ListBoxes. I would like to
I have an app that has a list of menu items. When you click
I have an app that has an about page. I would really like to
This is a simplification, but I have an app that has the following methods:
I have an app that has a lot of views including tableViews but one

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.