0

I want to create an empty dialog box with a text field inside. When the user enters data inside the box he must be redirected to another screen. I want the Dialog box to come up without any statements but must include a textfield

Michael Donohue
  • 11,776
  • 5
  • 31
  • 44
Rashmi.B
  • 1,787
  • 2
  • 18
  • 34

2 Answers2

2

That should be doable with a PopupScreen, EditField and maybe a ButtonField so the user can let you know he/she is done entering data.

Michael Donohue
  • 11,776
  • 5
  • 31
  • 44
1

Just create standard OK dialog and then add an EditField to it.

BasicEditField inputField = new BasicEditField();                     

Dialog d = new Dialog(Dialog.D_OK_CANCEL, "Enter your Username:", Dialog.OK, null, Dialog.DEFAULT_CLOSE);
d.add(inputField);     

int i = d.doModal();

if (i == Dialog.OK) {
    Dialog.inform("Your Username is : " + inputField.getText());
}

Here's a complete tutorial

ThePCWizard
  • 3,338
  • 2
  • 21
  • 32