I have two buttons in an activity ("Add" and "Edit") that open up a
dialog. Initially, the dialog dismisses fine if I open up the dialog
using the Add button. However, once I press the edit button (dialog
opens up, dismisses fine) and click on the Add button, the dialog no
longer closes when the "Done" or "Cancel" button for the dialog shows
up. I've tried putting in a try/catch but their are no problems.
Stepped through with debugger and when it hits pcDialog.dismiss(), it
executes, but the dialog never closes.

private Dialog addPCDialog()
        {
                pcDialog = new Dialog( this );

                pcDialog.setContentView( R.layout.party_createpc );
                pcDialog.setTitle( "Add PC" );


                Button createDoneBtn =
                        ( Button ) pcDialog.findViewById( R.id.createPCDone );
                Button cancelCreateBtn =
                        ( Button ) pcDialog.findViewById( R.id.createPCCancel );

                createDoneBtn.setOnClickListener(
                                new View.OnClickListener()
                                {
                                        @Override
                                        public void onClick(View v) {
                                                try {
                                                        if ( !editMode ) {
                                                                setPCStats( 
false );
                                                                
party.addMember( character );
                                                                adapter.add( 
character );
                                                        }
                                                        else if ( editMode ) {
                                                                setPCStats( 
true );
                                                                party.RemovePC( 
character.getCharName() );
                                                                
party.addMember( character );
                                                        }
                                                        setStates( 
STATE.DONE_ADD_BUTTON );
                                                        pcDialog.dismiss();
                                                        
adapter.notifyDataSetChanged();
                                                }
                                                catch( Exception e ) {
                                                        Toast.makeText( 
PCM_EditParty.this, "Exception",
                                                                        
Toast.LENGTH_SHORT ).show();
                                                }
                                        }
                                });

                cancelCreateBtn.setOnClickListener(
                                new View.OnClickListener()
                                {
                                        @Override
                                        public void onClick(View v)
                                        {
                                                pcDialog.dismiss();
                                                setStates( 
STATE.CANCEL_ADD_BUTTON );
                                        }
                                });
                return pcDialog;
        }

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

Reply via email to