I'm following along with this tutorial to build a sample android app using Retrofit and the StackOverflow API. In their MainActivity code on the onClick(View v) method they are referencing the view android.R.id.text1
but I do not see anything in their layout files with the ID of "text1". How can this be?
Also, I'm used to using OnClickListener as an anonymous inner-class. In this example the entire MainActivity implements OnClickListener and onClick(View)
is overridden in the class itself. Is there any benefit to doing it this way? They're using a switch statement to determine which layout item is being clicked and putting all the actions in the single onClick(View)
method.
Thanks!