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

  • Home
  • SEARCH
  • 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 8032081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:17:15+00:00 2026-06-05T01:17:15+00:00

I am getting this question due to another answer on here, but didn’t explain

  • 0

I am getting this question due to another answer on here, but didn’t explain how to do what I am asking
How to get the id of the row in onItemClick(ListView) when using a custom Adapter?

The answer which was accepted in that question is what I need since I am also making my own custom adapter (CursorAdapter), hence I will have the same problem. The problem is I have no idea how to accomplish that. I am looking at the Doc, and am not sure how to access the _id column from a cursor. Since the Doc doesn’t have the constant which we can get that info from I’m stuck. Any help figuring it out would be much appreciated.

EDIT: I was not clear on what my question was, but just to clarify, like the title, how can I override the getItemId() method in the CursorAdapter custom class I created?

  • 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-05T01:17:17+00:00Added an answer on June 5, 2026 at 1:17 am

    Assuming you don’t have the Cursor as a member of your Adapter:

    @Override
    public long getItemId(int position) {
        Cursor cursor = getCursor();
        cursor.moveToPosition(position);
        return cursor.getLong(mCursor.getColumnIndex("_id"));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This may seem like a simple question but i am getting an error when
Sorry if this is a really basic question but it's been really getting to
I fear this is a very trivial question. But I'm having some trouble getting
Ok... changing the question here... I'm getting an error when I try this: SELECT
First off, fairly new to JS but getting better :-) This question is similar
I imagine that this is a simple question, but I'm getting some strange results
I feel a bit silly for asking such a simple question but here goes...
I was having a look at this question: Getting random value from a SQLite
This question is similar to Getting Emacs fill-paragraph to play nice with javadoc-like comments
UPDATE : Since this question is getting some views, I figured I'd better highlight

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.