Guest User

Untitled

a guest
Jul 17th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. Context mContext = getApplicationContext();
  2. LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(LAYOUT_INFLATER_SERVICE);
  3. View layout = inflater.inflate(R.layout.dialog_register_app, (ViewGroup) findViewById(R.id.layout_root));
  4.  
  5. //Start building dialog
  6. AlertDialog.Builder builder = new AlertDialog.Builder(this);
  7. builder.setTitle(getString(R.string.dialog_register_app_title));
  8. builder.setView(layout);
  9. builder.setCancelable(false);
  10. builder.setPositiveButton(getString(R.string.dialog_register_confirm_button_text), new DialogInterface.OnClickListener() {
  11. public void onClick(DialogInterface dialog, int id) {
  12. //Auslesen der EditText
  13. EditText oUsername = (EditText) findViewById(R.id.edit_username);
  14. String strUsername = oUsername.getText().toString(); // This is line where exception is calling
  15. //Do something with strUsername
  16. }
  17. });
  18. AlertDialog alert = builder.create();
  19. alert.show();
  20. ...
  21. ...
  22. ...
  23.  
  24. EditText oUsername = (EditText) layout.findViewById(R.id.edit_username);
  25. String strUsername = oUsername.getText().toString(); // This is line where exception is calling
  26. ...
  27.  
  28. EditText oUsername = (EditText) layout.findViewById(R.id.edit_username);
  29. String strUsername = oUsername.getText().toString();
Add Comment
Please, Sign In to add comment