Consider this (anonymous):
speakBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { mTts.speak(words.getText().toString(), TextToSpeech.QUEUE_ADD, null); }});
against. this: (not anonymous):
class MyOuterClass { private class MyOnClickListener implements OnClickListener { @Override public void onClick(View view) { mTts.speak(words.getText().toString(), TextToSpeech.QUEUE_ADD, null); } }
With the exception of fewer lines, is there another advantage to the anonymous form?
Is there a performance advantage?
java anonymous-types inner-classes
an00b
source share