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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:54:02+00:00 2026-06-06T21:54:02+00:00

I want that as I click on list item the application should load another

  • 0

I want that as I click on list item the application should load another class and then display the required data on textview by retrieving the data from sqlite database

@Override
public void onItemClick(AdapterView<?> parent, View view,
        int position, long id) {
    // TODO Auto-generated method stub
    Intent intent = new Intent(DictionaryActivity.this,
            WordDetails.class);
    // Cursor cursor = (Cursor) adapter.getItem(position);
    id = wordList.getItemIdAtPosition(position);
    intent.putExtra("Word_ID", id);
    // cursor.getInt(cursor.getColumnIndex("_id"));
    startActivity(intent);
}

this code is in WordDetails class

wordId = getIntent().getIntExtra("WORD_ID", -1);
if (wordId == -1) {
    mean = (TextView) findViewById(R.id.mean);
    mean.setText("Error");
} else {
    SQLiteDatabase db = (new DatabaseHelper(this))
            .getReadableDatabase();
    Cursor cursor = db.rawQuery(
            "SELECT _id ,word, mean FROM Meanings WHERE _id = ?",
            new String[] { "" + wordId });
    if (cursor.getCount() == 1) {
        cursor.moveToFirst();
        mean = (TextView) findViewById(R.id.mean);
        mean.setText(cursor.getString(cursor.getColumnIndex("mean")));
    }
}

When I click on an item “Error” word is being displayed which is supposed to show, but wordTd equals -1. Why this wordId is not getting correct value? Thanks for your help.

  • 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-06T21:54:04+00:00Added an answer on June 6, 2026 at 9:54 pm

    The ‘keys’ used when putting Intent extras are case sensitive. You are putting the id as…

    intent.putExtra("Word_ID", id);
    

    …but then trying to get it with…

    wordId = getIntent().getIntExtra("WORD_ID", -1);
    

    In other words you’re putting Word_ID and trying to get WORD_ID. Change the code so they’re both the same and it should work.

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

Sidebar

Related Questions

I am developing a music application.I want song list that on a long click
In this app I want that as I click on button the data from
I have a form that i want an administrator to fill out, then click
Hi i m using GridView with hovermenu and i want that when we click
I have an click function that I want to trigger outside of the function
I want to know that can mouse click event detects colors or even strings.
I want to design a webpage login that when click on the login button
I want to make a code that counts the click on the link which
I have a div that I want when user click on a button slideUp
Ive got a div that i want to slide out on click using .show(slide,

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.