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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:42:56+00:00 2026-06-17T18:42:56+00:00

I am currently trying to add a sub menu and get it to do

  • 0

I am currently trying to add a sub menu and get it to do what I want. I’ve been looking online and can’t seem to see if it’s possible.

Right basically I have a button called ‘sign-in’ which the users will press to lad the submenu in which will have a label saying Username and then an editable text box allowing the user to type in their desired user name.

Is this possible?

The code I currently have is

@Override
public boolean onCreateOptionsMenu(Menu menu) 
{
    TextView txtUsername = (TextView) findViewById(R.id.txtUsername);
    EditText edit_username = (EditText) findViewById(R.id.edit_username);
    super.onCreateOptionsMenu(menu);
    SubMenu sub = menu.addSubMenu(0,1,0, "Sign-In");
    sub.add(0,11,0,edit_username);    //I have noticed this is wrong but the only way I thought it would work
    sub.add(0,12,0,txtUsername);    //same for here

    //add button for okaying the username

    return true;
}

obviously this is in the create options menu but like I said I would like it to load the menu when the user clicks sign in using the signIn void

public void signIn(View view) 
{
 //load menu here
}
  • 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-17T18:42:57+00:00Added an answer on June 17, 2026 at 6:42 pm

    You can add any number sub menus to the menu items but you cannot nest a sub menu. (Reference)

    Menus with sub menus are used in rare cases where there are a number of related sub menu items for a menu item.

    You can add a submenu to an item in any menu (except a submenu) by adding a element as the child of an . Submenus are useful when your application has a lot of functions that can be organized into topics, like items in a PC application’s menu bar (File, Edit, View, etc.).

    Refer this document to learn more about options menu.

    I don’t see a point in adding the user name and password fields to an options menu. You could use a sub activity or a dialog fragment to display those fields.

    In your code, you have two problems.

    SubMenu sub = menu.addSubMenu(0,1,0, “Sign-In”);
    sub.add(0,11,0,edit_username);
    sub.add(0,12,0,txtUsername);

    1. you cannot nest submenus.
    2. add (int groupId, int itemId, int order, CharSequence title) obviously takes CharSequence as parameter not the View widgets (your edittext and textview).
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently trying at add ajax to a site, after much reading I discovered that
I'm currently trying to add PGP signing support to my small e-mail sending script
I'm currently trying to add an MSChart to a partial view in ASP.NET MVC
I am currently trying to add a JavaScript confirm message when a user attempts
So currently I am trying to add a feature to a userscript I have
I'm currently trying to implement a simple Add-In for InfoPath 2010 Filler/Editor mode, which
I'm just new to Zend and currently I'm trying to add a dash(-) to
I've seen lots of answers to similar questions, but can't seem to get this
I am trying to add the current date (not time if i have the
I'm trying to add text to textarea in current pointer position, here's the code

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.