Answer the question
In order to leave comments, you need to log in
Terminology in Android development?
Suppose there are two TextViews that are connected by some logic and common behavior (for example, a number is entered into one, the second displays the multiplied value by two). These two fields appear in several places, in different Activities. Obviously, it is reasonable to put the behavior logic of these TextViews into a separate class. Example:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.setContentView(R.layout.some_layout);
TextView textViewA = (TextView) findViewById(R.id.textViewA);
TextView textViewB = (TextView) findViewById(R.id.textViewB);
TextViewController textViewController = new TextViewController(textViewA, textViewB);
}
public class TextViewController{
public TextViewController(TextView textViewA, TextView textViewB){
//creating listeners, setting texts, fetching data from models and so on
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question