Guest User

Untitled

a guest
Jul 17th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. @Override
  2. protected void onCreate(Bundle savedInstanceState) {
  3. // TODO Auto-generated method stub
  4. super.onCreate(savedInstanceState);
  5. setContentView(R.layout.main);
  6. final AlertDialog.Builder alert = new AlertDialog.Builder(this);
  7. final EditText input = new EditText(this);
  8. alert.setView(input);
  9.  
  10. alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
  11. public void onClick(DialogInterface dialog, int whichButton) {
  12. Toast.makeText(getApplicationContext(), value,
  13. Toast.LENGTH_SHORT).show();
  14. }
  15. });
  16.  
  17. alert.setNegativeButton("Cancel",
  18. new DialogInterface.OnClickListener() {
  19. public void onClick(DialogInterface dialog, int whichButton) {
  20. dialog.cancel();
  21. Toast.makeText(getApplicationContext(), value,
  22. Toast.LENGTH_SHORT).show();
  23.  
  24.  
  25. }
  26. });
  27.  
  28. Button addContact = (Button) findViewById(R.id.ButtonAddContact);
  29. addContact.setOnClickListener(new OnClickListener() {
  30.  
  31. @Override
  32. public void onClick(View v) {
  33. // TODO Auto-generated method stub
  34. alert.show();
  35. }
  36. });
  37. }
Add Comment
Please, Sign In to add comment