Reusing an activity by changing elements properties
Lets say we have a main class with 5 buttons, where when each clicked go to an activity that displays information with 2 textviews.

The layout for all 5 activities will be the same, so naturally I would want to use one activity and reuse it by changing the text displayed in those 2 textviews for each button pressed.

How can I do this? Thinking about having a global intent in my main class, which is called by startActivity() for each button together with .putExtra() method to send the extra data in order to know from what button it came from (so that I can change the textviews).

Any other solutions that are better?

One more question, how does one change the title of the activity with java code while the app is running? Before the app starts one can use the xml, but how to change it if I'm trying to reuse the activity?

    <activity android:name=".MynewClass"
    	      android:label="@string/class_text">
    </activity>
Reusing an activity by changing elements properties
===

Lets say we have a main class with 5 buttons, where when each clicked go to an activity that displays information with 2 textviews.

The layout for all 5 activities will be the same, so naturally I would want to use one activity and reuse it by changing the text displayed in those 2 textviews for each button pressed.

How can I do this? Thinking about having a global intent in my main class, which is called by startActivity() for each button together with .putExtra() method to send the extra data in order to know from what button it came from (so that I can change the textviews).

Any other solutions that are better?

One more question, how does one change the title of the activity with java code while the app is running? Before the app starts one can use the xml, but how to change it if I'm trying to reuse the activity?

    <activity android:name=".MynewClass"
    	      android:label="@string/class_text">
    </activity>