Guest User

Untitled

a guest
Jun 14th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. /**
  2. * IMPORTANT: Make sure you are using the correct package name.
  3. * This example uses the package name:
  4. * package com.example.android.justjava
  5. * If you get an error when copying this code into Android studio, update it to match the package name found
  6. * in the project's AndroidManifest.xml file.
  7. **/
  8.  
  9. package com.example.android.justjava;
  10.  
  11.  
  12.  
  13. import android.os.Bundle;
  14. import android.support.v7.app.AppCompatActivity;
  15. import android.view.View;
  16. import android.widget.TextView;
  17.  
  18. /**
  19. * This app displays an order form to order coffee.
  20. */
  21. public class MainActivity extends AppCompatActivity {
  22.  
  23. @Override
  24. protected void onCreate(Bundle savedInstanceState) {
  25. super.onCreate(savedInstanceState);
  26. setContentView(R.layout.activity_main);
  27. }
  28.  
  29. /**
  30. * This method is called when the order button is clicked.
  31. */
  32. public void submitOrder(View view) {
  33. display(1);
  34. }
  35.  
  36. /**
  37. * This method displays the given quantity value on the screen.
  38. */
  39. private void display(int number) {
  40. TextView quantityTextView = (TextView) findViewById(R.id.quantity_text_view);
  41. quantityTextView.setText("" + number);
  42. }
  43. }
Add Comment
Please, Sign In to add comment