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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:20:28+00:00 2026-06-12T04:20:28+00:00

registerForContextMenu(validate_button); @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { menu.add(It’s right); menu.add(It’s

  • 0
registerForContextMenu(validate_button);
@Override
    public void onCreateContextMenu(ContextMenu menu, View v,
            ContextMenu.ContextMenuInfo menuInfo) {

        menu.add("It's right");
        menu.add("It's wrong");
    }

    @Override
    public boolean onContextItemSelected(android.view.MenuItem item) {
        //i want to show another Context Menu to select next answer
        return true;
    }

How to show another ContextMenu when I click an item of the first ContextMenu?.

Its something like a questioner where you select answers from the ContextMenu items, depending on which next ContextMenu items must be Populated

  • 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-12T04:20:29+00:00Added an answer on June 12, 2026 at 4:20 am

    How to show another ContextMenu when i click an Item of the 1st
    ContextMenu??

    I don’t know how deep you want the ContextMenu to be but for two levels you could have a boolean flag, to select between the two cases, which will be updated from onContextItemSelected:

    boolean flag = true;
    
    @Override
    public void onCreateContextMenu(ContextMenu menu, View v,
            ContextMenu.ContextMenuInfo menuInfo) {
        if (flag) {
           menu.add("It's right");
           menu.add("It's wrong");
        } else {
           // the second menu
           menu.add("Ha Ha");
        }
    }
    

    Then in the onContexItemSelected callback simply update the flag and post a Runnable to show the ContextMenu again:

    @Override
    public boolean onContextItemSelected(MenuItem item) {
           if (item.getItemId() == theIdOfItemFromSecondContextMenu) {
            // do stuff
            return true;
        }
        // if you pass at this level, then you need to show the second ContextMenu
        flag = false;
        theView.post(new Runnable() {
    
            @Override
            public void run() {
                theView.showContextMenu();
            }
        });
        return true;
    }
    

    Anyway, I would advise against such code and simply use a custom Dialog(or a DialogFragment to have a backstack for the user to cycle through).

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

Sidebar

Related Questions

Here is the problem @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); progressDialog = ProgressDialog.show(ContactMainActivity.this,
I'd like to add a context menu on an entire Android WebView. I have
This is my ListActivity: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.my_list); mDbHelper =
I have a listview and I called registerForContextMenu . In the ContextMenu I only
Consider an Android ListView with a context menu set up with registerForContextMenu . The
I a view have for which I would like to show a ContextMenu on
what's the difference between registerForContextMenu : Registers a context menu to be shown for
public void getData(String empid) { Cursor cursor = assignment.getAcceptedTasks(empid); startManagingCursor(cursor); list = (ListView) findViewById(R.id.list);
In Activity class, there is method called registerForContextMenu(View view) . The android document explains
I'd like to show a ContextMenu for a custom View which is not part

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.