Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- // TODO Auto-generated method stub
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- final AlertDialog.Builder alert = new AlertDialog.Builder(this);
- final EditText input = new EditText(this);
- alert.setView(input);
- alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int whichButton) {
- Toast.makeText(getApplicationContext(), value,
- Toast.LENGTH_SHORT).show();
- }
- });
- alert.setNegativeButton("Cancel",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int whichButton) {
- dialog.cancel();
- Toast.makeText(getApplicationContext(), value,
- Toast.LENGTH_SHORT).show();
- }
- });
- Button addContact = (Button) findViewById(R.id.ButtonAddContact);
- addContact.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- // TODO Auto-generated method stub
- alert.show();
- }
- });
- }
Add Comment
Please, Sign In to add comment