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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:56:03+00:00 2026-05-16T22:56:03+00:00

Good day, could you please help me look and this code and tell me

  • 0

Good day, could you please help me look and this code and tell me what am doing wrong. I have a listview from a Cursor Adapter but when i click on a row, it returns back the row above it and not the target row clicked. which leads to if you click on the first row, it crashes with a “cursor out of bound exception”. But when i add the c.moveToFirst() just before the intent invocation and i click on the first row, it just does nothing. Please here is the code:

public void onItemClick(AdapterView<?> parent, View view, int position, long rowId) {

   c = adapter.retrieveRow(rowId);

 Intent edit = new Intent(this,Item.class);
 edit.putExtra(DBAdapter.KEY_ID, rowId);
edit.putExtra(DBAdapter.NAME, c.getString(c.getColumnIndex(DBAdapter.NAME)));
edit.putExtra(DBAdapter.START_DATE, c.getString(c.getColumnIndex(DBAdapter.START_DATE)));
startActivityForResult(edit, ACTIVITY_EDIT);
}

and here is the database method that is being called:

public Cursor retrieveRow(long rowId) {
 String[] resultColumns = new String[] {NAME,START_DATE};
             Cursor row = db.query(true,DATABASE_TABLE, resultColumns, KEY_ID +"=" +rowId, null, null, null, null,null);
   if(row != null){
             row.moveToFirst();
   }
    return row;
   }

i tried changing it to a OnListItemSelected() but nothing happened, it did not return anything at all.I am using the new view and bind view method on the cursor adapter. thanks in advance.

  • 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-16T22:56:03+00:00Added an answer on May 16, 2026 at 10:56 pm

    Try to replace c = adapter.retrieveRow(rowId);

    with c = adapter.getItem(position);

    And comment out your retrieveRow method

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

Sidebar

Related Questions

Good day, I need to extract portion of string which can looks like this:
Good day. I'd like to ask a question. Why TextBox control Txt in this
Good day to all. I have the following setup: A page with html, js,
hope you're having a good day. I have been programming a IRC chatbot in
Good day, We just converted our web application .NET 1.1 to .NET 2.0. We
Good day, I'm having a problem with asp.net 2.0 viewstate. Basically, I want to
Good day, In visual studio 2005, when I drop a webcontrol in the designer,
I've spent a good part of the day searching, writing and finally scrapping a
Good afternoon, This should be an easy one. I've done the cookie-cutter default ASP.NET
Good morning. I have an XML file which contains lists of warning and errors

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.