Skip to content
Advertisement

How to change Textview text in Activity from class that extends RelativeLayout

In my MainActivity I have one TextView. Now, inside other class that extend Relative Layout, I have implemented one MessageListener that (using onNewMessage method) recieve every second some values. I want to put this values inside my TextView that are in MainActivity. This is a simply example of my class:

JavaScript

Thanks for help.

Advertisement

Answer

If you call this Class in your MainActivity class, so you can add to your constructor another value which will be your Textview

JavaScript

Now you can change it’s text by using

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement