I'm having trouble saving String values ββthat are inside edittext .
What happens is a dialog shows, with edittext , ok and a cancel button.
When the OK button clicked, what I want to do is for bar -variable to get the string-value from edittext .
public void dialog(){ final Dialog dialog = new Dialog(myClass.this); dialog.setContentView(R.layout.mydialog); dialog.setTitle("I'm soo smart. SMRT. Smart."); dialog.setCancelable(true); dialog.show(); Button okButton = (Button) dialog.findViewById(R.id.dialog_OK_BUTTON); okButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { try{ LayoutInflater factory = LayoutInflater.from(Inloggning.this); final View textEntryView = factory.inflate(R.layout.myDialog, null); final EditText barText= (EditText) textEntryView.findViewById(R.id.dialog_FOO);
Can someone shed some light on this, please?
EDIT: This is sample code. Actual code does not have duplicate names for variables.
2ND EDIT: duplicates removed ..
source share