F
F
FoxInSox2013-11-29 16:48:45
Android
FoxInSox, 2013-11-29 16:48:45

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
    }
}

Question: Is there a settled, generally accepted name for such classes? ViewController or just Controller? Indeed, in fact, any Activity containing more or less complex content is more convenient to divide into similar components, rather than cram everything into one Activity file.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bimeg, 2013-11-29
@FoxInSox

In my opinion, this is easier to do in fragments .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question