Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. package bixby.party;
  2.  
  3. import android.app.Activity;
  4. import android.os.Bundle;
  5. import android.view.View;
  6. import android.widget.Button;
  7. import android.widget.EditText;
  8. import android.widget.Toast;
  9.  
  10. public class NewEvent extends Activity {
  11. public void onCreate(Bundle savedInstanceState) {
  12. super.onCreate(savedInstanceState);
  13. setContentView(R.layout.edit_text);
  14.  
  15.  
  16. final EditText eventNameET = (EditText) findViewById(R.id.eventNameET);
  17. final EditText locationET = (EditText) findViewById(R.id.locationET);
  18. final EditText numGirlsET = (EditText) findViewById(R.id.girlsET);
  19. final EditText numGuysET = (EditText) findViewById(R.id.guysET);
  20.  
  21. final Button button = (Button) findViewById(R.id.eventButton);
  22. button.setOnClickListener(new View.OnClickListener()
  23. {
  24. public void onClick(View v)
  25. {
  26. // Perform action on click
  27. String eventName = eventNameET.getText().toString();
  28. String location = locationET.getText().toString();
  29. String numGirls = numGirlsET.getText().toString();
  30. String numGuys = numGuysET.getText().toString();
  31.  
  32. String display = eventName + ":" + location + ":" + numGirls +
  33. ":" + numGuys;
  34. // uncomment to clear text after buttonpress
  35. // edittext.setText("");
  36. Toast.makeText(NewEvent.this, display, Toast.LENGTH_SHORT).show();
  37. }
  38. });
  39.  
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement