0

Explain this code

Button b = (Button)findViewById(R.id.button1); b.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(getApplicationContext(),"Nitya is a good girl",Toast.LENGTH_LONG).show(); } });

25th Jan 2022, 6:39 AM
Abhishek
Abhishek - avatar
1 Answer
0
Button b = (Button)findViewById(R.id.button1); //Create a reference to button1 called b b.setOnClickListener(new View.OnClickListener() { //add event listener to b @Override //override the onClick method public void onClick(View v) { Toast.makeText(getApplicationContext(),"Nitya is a good girl",Toast.LENGTH_LONG).show(); //show a toast message in the application context during long (3 seconds if i well remember) } });
25th Jan 2022, 8:19 PM
Marco Ginato
Marco Ginato - avatar