I was just reading "Head First Android" and came across this code snippet,
public class WorkoutListFragment extends ListFragment{
static interface WorkoutListListener{
void itemClicked(long id);
}
}
// Inside the same class there is this Inner Interface
// declaration of the above Interface,
// Declaration style : 01
private WorkoutListListener listener;
If i write like this below snippet is it better?
// why can't i declare the Inner Class like this in the same class,
// Because I write WorkoutListFragment.WorkoutListListener while implementing it,
// Declaration style : 02
private WorkoutListFragment.WorkoutListListener listener;
My query is which is the convention here, Declaration style 1 or 2? Because as I have seen here in StackOverflow that while implementing an Inner Interface we use the outer class or Interface name then give Dot and then write the Inner Interface name. like this,
public SomeClass implements SomeOuterClass.AnInnerInterface{
....
}
N.B: Please note, the comments are not in the actual code. I have added them for the clarity of my query.