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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:31:57+00:00 2026-05-23T11:31:57+00:00

I have a ListView in activity1 where I have a few items which are

  • 0

I have a ListView in activity1 where I have a few items which are the word from the database . The User Clicks on an item in the Listview and it will navigate to activity2 where it should show the details of the word which are stored in database as column word, definitions . But What appears in Screen2 depends on what item was clicked in Screen 1

For Ex – User Clicks A in Screen 1 – Words starting from A come up in Screen 2. Is there any way to pass the row id so that in next screen the word and definition from the database can be displayed.

Thank you in adv..
code for first activity:

lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView parent, View v, int position, long id) {
            // TODO Auto-generated method stub


            Cursor c = mDictCursor;
            c.moveToPosition(position);
            Intent i = new Intent(FirstActivity.this, SecondActivity.class);
            Bundle bundle=new Bundle();
            //intent.putExtra("position",position);
            bundle.putLong(DBAdapter.KEY_ROWID, id);
            bundle.putString(DBAdapter.KEY_TITLE, c.getString(
                  c.getColumnIndexOrThrow(DBAdapter.KEY_TITLE)));
            bundle.putString(DBAdapter.KEY_DEFINITION, c.getString(
                    c.getColumnIndexOrThrow(DBAdapter.KEY_DEFINITION)));
            i.putExtras(bundle);
            startActivity(i);
        }

SecondActivity code:

Bundle extras = getIntent().getExtras();

        mRowId = extras.getLong(DBAdapter.KEY_ROWID);
        String title = extras.getString(DBAdapter.KEY_TITLE);
        String body = extras.getString(DBAdapter.KEY_DEFINITION);


        TextView word = (TextView) findViewById(R.id.word);
        word.setText(title);

            TextView definition = (TextView) findViewById(R.id.definition);
            definition.setText(body);
        }

Whenever I am clicking the listview item it is showing dialog to force close. Please 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-05-23T11:31:58+00:00Added an answer on May 23, 2026 at 11:31 am

    you can use Intent object putExtra(String name, int value) method in Screen1(see1) and pass the intent object to Screen2,in Screen2 use getIntExtra(String name, int defaultValue) method of Intent object(see 2).
    1.use startActivity(Intent intent) method in Screen1
    2.use getIntent() method in Screen2 to get Intent object which you passed in the Screen1

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

Sidebar

Related Questions

I have a listview which displays items retrieved from the webpage. Each item in
I have a problem with my listview which contains an ImageView and a few
Activity1 has a listView . Clicking one item (let's say item 3) will start
I have a ListView in my activity that is populated from a database Cursor
I have a listview withcin a activity and when someone clicks on an item
I have an activity which consists of a ListView . The problem is that
I have ListView in my project which has ListItems as in the form of
I have a listview activity in which I set the selector color using the
I have a listView with some data coming from a server.I want to do
I have a listview that is populated by a by objects from an Offer

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.