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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:03:01+00:00 2026-06-04T21:03:01+00:00

actually i got a problem while creating my project. I am having one list

  • 0

actually i got a problem while creating my project. I am having one list view in one screen where data comes from database & binds to it. I created one context menu here with two menus (view & delete). The problem i am facing is when i make a long click context menu occur & when i click on anyone of the menu it navigates to another screen. here i want the listview(which was clicked) item data to pass to next screen. By i am not getting it. This is the following code…

Main.java

     /*******some code****/

    DbHandler dbh=new DbHandler(GroupName.this);
    ast=dbh.selectgroupnam(s); 
       //here "ast" is of ArrayList defined globally        
    ArrayAdapter<String> adp=new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,ast);
    lv.setAdapter(adp);
    registerForContextMenu(lv); 

    lv.setOnItemClickListener(new OnItemClickListener(){
    @Override
    public void onItemClick(AdapterView<?> arg0, View v, int p, long arg3) {
    // TODO Auto-generated method stub  
     TextView tv=(TextView)v;
     String gnam=tv.getText().toString();

}});

  }//on create

   //context menu code

   @Override
   public void onCreateContextMenu(ContextMenu menu, View v,
        ContextMenuInfo menuInfo) {
    // TODO Auto-generated method stub
    super.onCreateContextMenu(menu, v, menuInfo);
        menu.add(0, v.getId(), 0, "View");  
        menu.add(0, v.getId(), 0, "Delete");    
}

@Override
public boolean onContextItemSelected(MenuItem item) {
    // TODO Auto-generated method stub
    Toast.makeText(getApplicationContext(), "group name" + gnam,30).show();
    if (item.getTitle() == "Delete") {
        Toast.makeText(getApplicationContext(), "selected group" + gnam, 30).show();
    startActivity(new Intent(GroupName.this,GroupEdit.class));
    }
    else 
    {
    startActivity(new Intent(GroupName.this,GroupEdit.class));
    }
    return super.onContextItemSelected(item);
}

As per the following code how to get the list view data (which was long clicked for context menu) & pass the data to GroupEdit.class.

Waiting for reply……

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

    So you start activity startActivity(new Intent(GroupName.this,GroupEdit.class))
    but any data you are adding to intent.
    So try it with putExtra(<key>,<data>) or if you want to use Bundle so putExtras(<bundle>)

    You should to it like this:

    Intent i = new Intent(GroupName.this,GroupEdit.class);
    i.putExtra("key", <data>);
    startActivity(i);
    

    Then in new Activity GroupEdit you get this data with getIntent() method that return the intent that started this activity and getExtras() with it you retrieve a map of extended data from the intent.

    So in GroupEdit String text = getIntent().getExtras().getString("keyOfField")

    Of you will use Bundle so

    Intent i = new Intent(GroupName.this,GroupEdit.class);
        i.putExtras(bundle);
        startActivity(i);
    

    in GroupEdit you retrieve data with Bundle data = getIntent().getExtras()

    Regards

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

Sidebar

Related Questions

Actually I am confronted with a Problem. I've got a .apk-File in one Package
I got a similar problem to this guy while processing 4MB log file. Actually
I got a question ;) Actually I want to use core-data in different threads.
I've got XML coming back from an Ajax.Request in Ajax.Response.responseXML . My XML actually
I've got to develop a multi-language code generator in C#. Well actually the idea
I've got an ASP document that 5 years old. Actually I'm working with PHP
I was actually going through the question 1636644 .. and got confused with this
Today I've got a stacktrace with a very strange error. Actually, I may be
Actually in the center of current view, above all other objects. Cross-browser and without
i've got this snazzy python code: import subprocess value = subprocess.Popen([php,./php/php_runner.php],stdout=subprocess.PIPE); the problem is,

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.