Android Class which extends Dialog, how to clear TextViews before it is displayed

Posted by wuntee on Stack Overflow See other posts from Stack Overflow or by wuntee
Published on 2010-03-17T04:06:08Z Indexed on 2010/03/17 4:11 UTC
Read the original article Hit count: 332

Filed under:
|

I have a class that extends android.app.Dialog, the layout is done in an xml file, and the setup (button listeners, etc) is done on the onCreate method. My problem is that whenever the dialog is displayed, then dismissed, and displayed again, the Editable TextViews are still populated with the information that was displayed previously. What is the common way to clear these text fields? Remember - this is a separate class that extends Dialog - so there is no 'onDialogCreate' like Activity has.

Or, perhaps I am extending the wrong class? There is just a lot of processing being done, and do not want to have all the code in the main Activity. I would like it to be in a separate Class. I tried to extend AlertDialog, but it does not create the border like Dialog does. Any help would be great.

The dialog is shown via the Activity:

    protected Dialog onCreateDialog(int id) {
        switch(id){
            case DIALOG_NEW_SAFE:
                return(new NewSafeDialog(this));
            default:
                return(null);
        }
    }

© Stack Overflow or respective owner

Related posts about android

Related posts about dialog