In the code below, I created the button listener and when I tried to create the method on()
eclipse suggested to create it as part of the OnClickListener
or as part of the mainClass.
What is the difference beteen creating the method on()
in both cases, and why it should be protected
?
code:
private OnClickListener btnListenerOn = new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
on();
}
};
@Override
protected void onStart() {
// TODO Auto-generated method stub
super.onStart();
Log.w(TAG, "@onStart.");
}
protected void on() {
// TODO Auto-generated method stub
}