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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:03:03+00:00 2026-05-23T14:03:03+00:00

I am working with a listview where the primary key is text , not

  • 0

I am working with a listview where the primary key is text, not an integer. It’s actually a unique url

It works so far, I even managed to alias the url column to _id in the rawQuery() and the listview accepts it happily.

But now I have run into a problem!

onListItemClick() returns the id as a long so when I click on an item I just get 0 no matter what.

Is it possible to obtain the clicked id somehow else?

  • 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-05-23T14:03:03+00:00Added an answer on May 23, 2026 at 2:03 pm

    It should be possible to add an field _id to your db. Other wise this may work for you:

    protected void onListItemClick(ListView l, View v, int position, long id) {
        Cursor c = (Cursor) getListAdapter().getItem(position);
        String url = c.getString(c.getColumnIndex("_id"));
    }
    

    This solution won’t work if you use filtering on the Adapter like in this question. onListItemClick will report the position after the filtering.

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

Sidebar

Related Questions

While working over listView I have came across a trouble situation. Actually I am
Does anyone know why my ListView with following Code is not working? I checked
i'am working on an autogrowing listview. Everytime before i call mAdapter.notifyDataSetChanged(); i toggle the
Been trying to find a working implementation of a WPF listview (or listbox) where
I'm working on a control to tie together the view from one ListView to
I am working with listview in C# webapplication. My Problem is I want checked
I'm working on a ListView. I'd like to get the selected elements and stock
I'm working on an Android application with ListView/GridView. Since I set an onClickListener on
I'm working on an app that currently just uses a listview for a menu,
I am working on android applications. In my page I kept listheader,listview and listfooter.

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.