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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:57:59+00:00 2026-06-12T02:57:59+00:00

hi am really struck with this question. I’m new in android world.I have a

  • 0

hi am really struck with this question. I’m new in android world.I have a list which display info from database.(id , name and description). On click and hold operation i want to delete selected row from database. I already implemented the context menu but am not getting the id from database but returns position (0 but id from db is 1).thanx

i think i got it 🙂

public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, view, menuInfo);
    TextView ids = (TextView)findViewById(R.layout.list_row);
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
    int position = info.position;
    int foldeiId=(Integer) adapter.getItem(position);
    String fd = String.valueOf(view.getId());
    // Log.w("Data id arunmr: ", foldeiId);
    System.out.println(foldeiId);
    menu.setHeaderTitle("Options");
    menu.add(0, NEW_MENU_ITEM, foldeiId, "Delete");
    menu.add(0, SAVE_MENU_ITEM, foldeiId, "Rename");
}

but any idea how to access the mentioned “foldeiId” from context menu ?

  • 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-12T02:58:00+00:00Added an answer on June 12, 2026 at 2:58 am

    try this
    You can get the foldeiId if you declare that variable outside the oncreate() method

    @Override  
    public boolean onContextItemSelected(MenuItem item) {  
        if(item.getTitle()=="Delete"){
            // delete the item you want to delete
    }  
    else if(item.getTitle()=="Rename"){
          // rename the item you want to 
    }  
    else {return false;}  
    return true;  
    }  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I realize this question is pretty basic, but I'm really stuck. I have a
I'm sure this is a really easy to answer question but I'm still new
I really don't have a clue how to give this question a good title
This struck me as really weird behaviour and I spent a while checking for
I have been stuck on this and don't really know how to go about
I apologize for the stupid question, but I feel like I've really struck a
i'm sorry for asking this question because i think it has a really simple
I know this is very common question but I am really stuck in this
( This question , though similar, didn't really answer my question.) I've had problems
This is a really easy question I'm sure but I'd appreciate the help. :)

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.