Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Button button = (Button) findViewById(R.id.button);
- final EditText editText = (EditText) findViewById(R.id.edit_text);
- button.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
- builder.setTitle("Digite o texto");
- final EditText input = new EditText(MainActivity.this);
- builder.setView(input);
- builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- editText.setText(input.getText().toString());
- }
- });
- builder.setNegativeButton("Cancelar", null);
- builder.show();
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement