Guest User

Untitled

a guest
Jul 4th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.78 KB | None | 0 0
  1. public class SimpleNotification extends AppCompatActivity {
  2.  
  3.     private int count = 0;
  4.     private TextView counter;
  5.  
  6.     @Override
  7.     protected void onCreate(Bundle savedInstanceState) {
  8.         super.onCreate(savedInstanceState);
  9.         setContentView(R.layout.activity_simple_notification);
  10.         Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
  11.         counter =   (TextView) findViewById(R.id.counter);
  12.         setSupportActionBar(toolbar);
  13.  
  14.  
  15.         FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
  16.         fab.setOnClickListener(new View.OnClickListener() {
  17.             @Override
  18.             public void onClick(View view) {
  19.  
  20.                 count++;
  21.                 counter.setText(count);
  22.  
  23.             }
  24.         });
  25.  
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment