I am trying to fully integrate the concept of anonymous classes and interfaces in Android and Java. In another thread, an answer was given to a question about something like:
getQuote = (Button) findViewById(R.id.quote);
getQuote.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
}
"What is sent in an anonymous class, you can also make a separate class that implements OnClickListener and instantiates this class and sends it as an argument to setOnClickListener." - John
My question is, what would the code look like if you went the long way to create a separate class that implements OnClickListener? I think if I saw a long route, it would make more sense. Many thanks!
source
share