Where to set all Listeners for the user interfaces?
Is it good practice to set them in onCreate? This looks so unstructured and strange.
Is
Use onCreate method to set the UI and to get the Widget from UI.
protected void onCreate(Bundle savedValues) {
// Here set the UI and get the widgets
//set the Listeners on the widgets you are getting at the above line
}
And you can define a clickListener for the widgets and use it in onCreate method
OnClickListener someListener = new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Toast.makeText(v.getContext(), "widget pressed ", Toast.LENGTH_SHORT).show();
}
};
and you can set the above clickListener to a widget which you have created in onCreate method