Which of these approaches for a button click is better/faster/more efficient, and why?
Approach One:
Button button = (Button) findViewById(R.id.button_english_splash);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Toast.makeText(v.getContext(), "Clicked!", Toast.LENGTH_SHORT)
.show();
}
});
Approach Two:
((Button) findViewById(R.id.button_english_splash))
.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Toast.makeText(v.getContext(), "Clicked!",
Toast.LENGTH_SHORT).show();
}
});