Android Community Forums - View Single Post - Dialog Information Retrieval
View Single Post
  #1  
Old 07-03-2009, 04:11 PM
aspekt9 aspekt9 is offline
aspekt9 is frustrated
Smoke signaler
 
Join Date: Jul 2009
Posts: 3
aspekt9 is on a distinguished road
Default Dialog Information Retrieval

I have a program that uses a Map View and when they click a menu item it prompts them (in a Dialog box) to enter a name and then press enter. Once they press enter I want to take what was received in the Text Edit in the dialog box and display it in a toast. However, it seems that I just get a blank toast when I try this. Here's some code:

I use getters and setters to accomplish this:

Code:
public void setText(String text) {
        test = text;
    }
    public String getText() {
        return test;
    }
My button listener:

Code:
btn_save = (Button) findViewById(R.id.btn_save);
        btn_save.setOnClickListener(new Button.OnClickListener() {
            public void onClick(View v) {
                setText(add_dialog_editText.getText().toString());
                dismiss();
            }
        });
I then call the dialog in my ItemizedView class:

Code:
POIDialog d = new POIDialog(mContext);
                d.setTitle("Add a POI");
                d.setContentView(R.layout.adddialog);
                d.show();
But when I use d.getText(), it wont show the value that was entered in the box. Is there a better way to receive entered data in a dialog box?
Reply With Quote
Ads