M
M
Millerish2016-09-07 16:36:41
Android
Millerish, 2016-09-07 16:36:41

android how to access MainActivity from another class?

Good afternoon!
Tell me how to access the MainActivity element from another class? There are two files A.class and B.class.
A class

public class MainActivity {
...
    Bclas B= new Bclas ();
    TextView TV;
...
}

How can I access TextView TV from B.class which is in A.class?
This is not how TV = (TextView) findViewById(R.id.TV ); and so too TextView TV = (TextView) MainActivity.findViewById(R.id.TV );

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question