I tried, but nothing... I always get the leaked window... :(

I have also tried a simple test app with only one Activity with a
Button to show the submenu... I got the same problem, is it normal? I
don't understand where is the problem!

Try this, please

public class SubMenuTestActivity extends Activity {

        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.main);
        }

        @Override
        public boolean onCreateOptionsMenu(Menu menu) {
                // Posizione di riferimento
                int order = Menu.FIRST;
                // Definizione del gruppo
                int myGroupId = 0;
                // Aggiungiamo un menu normale
                menu.add(myGroupId, order, order++, "Normal");
                // Aggiungiamo un sottomenu
                int subGroupId = 10;
                SubMenu subMenu = menu
                                .addSubMenu(subGroupId, order, order++, 
"SubMenu");
                subMenu.add(subGroupId + 1, order, order++, "Prima Multipla")
                                .setCheckable(true);
                subMenu.add(subGroupId + 1, order, order++, "Seconda Multipla")
                                .setCheckable(true);
                subMenu.add(subGroupId + 2, order, order++, "Prima Exclusive");
                subMenu.add(subGroupId + 2, order, order++, "Seconda 
Exclusive");
                subMenu.setGroupCheckable(subGroupId + 2, true, true);
                // Impostiamo il titolo
                subMenu.setHeaderTitle(R.string.sub_title);
                subMenu.setHeaderIcon(R.drawable.icon);
                subMenu.setIcon(R.drawable.icon);
                // Visualizziamo il menu
                return true;
        }

        @Override
        public boolean onOptionsItemSelected(MenuItem item) {
                item.setChecked(!item.isChecked());
                return super.onOptionsItemSelected(item);
        }

}

On 27 Lug, 18:57, Paolo <[email protected]> wrote:
> I thought Android managed it for me, too. But it doesn't seem to be
> so...
>
> Now I try your suggestion... I inform you soon. thanks.
>
> On 27 Lug, 18:15, TreKing <[email protected]> wrote:
>
>
>
> > On Tue, Jul 27, 2010 at 5:52 AM, Paolo <[email protected]> wrote:
> > > I get a leaked window when I have a submenu visible on the screen and I
> > > rotate the screen.
>
> > Weird. Seems like something the framework should handle automatically ...
>
> > > If it would be a Dialog I colud call dismiss() in the onStop() before to
> > > change the orientation, but with a SubMenu how do I can solve it?
>
> > Maybe 
> > this?:http://developer.android.com/reference/android/app/Activity.html#clos...()
>
> > <http://developer.android.com/reference/android/app/Activity.html#clos...()>
> > --------------------------------------------------------------------------- 
> > ----------------------
> > TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> > transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to