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

The Archive Base Latest Questions

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

I’m trying to have a list of items that when touched will open another

  • 0

I’m trying to have a list of items that when touched will open another list of items. Rather like a sub menu of items. This is because my first list is getting to long and I would like to group some together into a sub menu.

    gridView.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View v, final int position, long id) {

           final CharSequence[] items = {"Gallery Image Menu", "View pattern", "Delete pattern", "Locate pattern in list view", "Row Counter (with pattern)", "Share Pattern", "Share Image", "Cancel"};

            AlertDialog.Builder builder = new AlertDialog.Builder(grid.this);
            builder.setTitle(selectedimage);
            builder.setItems(items, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int item) {


                    if (item == 0){
                        //first menu 1st item
                        dialog.dismiss();

                        final CharSequence[] items2 = {"Rotate image 180"+"\u00B0", "Rotate image 90"+"\u00B0", "Add image from pattern",  "Add image from file", "Add image from camera", "Remove image", "Cancel"};

                        final AlertDialog.Builder builder2 = new AlertDialog.Builder(grid.this);
                        builder2.setTitle(selectedimage);
                        builder2.setItems(items2, new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog2, int item) {


                                if(item == 0){
                                    //2nd menu, 1st item
                                    dialog2.dismiss();

                                    //do something
                                    return;
                                }

                                if(item == 1){
                                    dialog2.dismiss();
                                    //2nd menu, 2nd item
                                    //do something else
                                    return;
                                }


                            AlertDialog alert2 = builder2.create();
                            alert2.show();

                            }
                        });
                    }


                    if (item == 1){
                        //first menu 2nd item
                    }


                    if(item == 2){
                        //1st menu, 3rd item
                    }


                    if(item == 3){

                    }

                    //..... etc


                }
            });
            AlertDialog alert = builder.create();
            alert.show();


        }

    });//gridView.setOnItemClickListener

The first builder displays as expected but when I select the first option which I want to open the 2nd builder the first builder closes and returns to activity.

When in debug mode the 2nd builder code is read as if it was going to display but then both close.

Perhaps you cannot do this?

Any ideas?

  • 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-17T17:42:26+00:00Added an answer on June 17, 2026 at 5:42 pm

    You misplaced the

    AlertDialog alert2 = builder2.create();
    alert2.show();
    

    part. Move it 3 lines down, after });

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I have a small JavaScript validation script that validates inputs based on Regex. I
I have this code to decode numeric html entities to the UTF8 equivalent character.
I am trying to render a haml file in a javascript response like so:
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

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.