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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:47:28+00:00 2026-06-15T10:47:28+00:00

I have a dialog that shows a ListView of certain items like this d

  • 0

I have a dialog that shows a ListView of certain items like this

d = new Dialog(this);
d.setContentView(R.layout.dialog_layout);
d.setTitle("Select Bowler " + String.valueOf(bakerList.size()+1));

ListView lv3 = (ListView)d.findViewById(R.id.dialog_list);
Cursor c3 = getContentResolver().query(TeamBowlers.CONTENT_URI,new String[] {TeamBowlers.ID,TeamBowlers.SUB,TeamBowlers.BOWLER_ID,TeamBowlers.CAPTAIN}
    ,TeamBowlers.TEAM_ID + "=?",new String[] {String.valueOf(teamSelectedID)},TeamBowlers.POSITION + " ASC");                                       

if(c3.moveToFirst() && c3 != null){
    SimpleCursorAdapter adapter2 = new ImageAdapter(this,R.layout.row,c3
            ,new String[] {TeamBowlers.ID,TeamBowlers.SUB,TeamBowlers.BOWLER_ID},new int[] {R.id.icon,R.id.bowler_txt,R.id.bowler_txt2});

    lv3.setAdapter(adapter2);
    lv3.setOnItemClickListener(new OnItemClickListener(){

        @Override
        public void onItemClick(AdapterView<?> arg0, View v,int position, long id) {
            bakerList.add(id);
            updateName(id);
        }

    });
    d.show();
}

problem is that when I click on an item in the list the ID that gets returned is not the id from the database it just returns the index basically.

why is it not binding my “_id” column of my database?

  • 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-15T10:47:29+00:00Added an answer on June 15, 2026 at 10:47 am
    why is it not binding my "_id" column of my database?
    

    I guess it is not true. That id in the onItemClick is actually the row id in list view, it is not the id from your cursor

    If you want the row data you can do some thing like this in onItemClick

    Cursor cursor = ((SimpleCursorAdapter) arg0).getCursor();
    cursor.moveToPosition(position);
    long _id= cursor.getLong(cursor.getColumnIndex("id");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a dialog that shows a multi-choice list of items that can
I have sectioned custom ListView that contains RadioButton on each items. When a Dialog
Well i have a div tag that i show as a modal dialog this
I have a custom Dialog that shows a few buttons. The idea is to
I have a dialog to choose files from. This dialog contains a listview to
I have a activity (Contato) that shows a ListView of the contacts i have
I have a list of items, created by a listview. I would like to
I have a listview. What I would like to achieve is that when I
I would like to show an alert dialog that shows a counter(timer of time)
I have a dialog that I show with <class>.ShowDialog() . It has an OK

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.