Advertisement
khamim

Untitled

Jul 16th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 0.91 KB | None | 0 0
  1. public class MainActivity extends AppCompatActivity {
  2.     private int mCount = 0;
  3.     private TextView mShowCount;
  4.     Button button_count;
  5.     TextView show_count;
  6.     @Override
  7.     protected void onCreate(Bundle savedInstanceState) {
  8.         super.onCreate(savedInstanceState);
  9.         setContentView(R.layout.activity_main);
  10.  
  11.         button_count= (Button) findViewById(R.id.button_count);
  12.         show_count= (TextView) findViewById(R.id.show_count);
  13.         button_count.setOnClickListener(new View.OnClickListener() {
  14.             @Override
  15.             public void onClick(View v) {
  16.                 mCount ++;
  17.                 show_count.setText(Integer.toString(mCount));
  18.             }
  19.         });
  20.  
  21.  
  22.     }
  23.  
  24.     public void countUp(View view) {
  25.     }
  26.  
  27.     public void ShowToast(View view) {
  28.         Toast toast = Toast.makeText(this, "hello toast", Toast.LENGTH_LONG);
  29.         toast.show();
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement