I have the following Java code that allows me to dynamically change the text in my Android app header bar - retrieving the name from Strings.xml.
// Display header title
headertitle = findViewById(R.id.header_title);
int id = getResources().getIdentifier(getLocalClassName(), "string", getPackageName());
String header = getResources().getString(id);
headertitle.setText(header);
I don't want to include this in every Activity so how do I create a file that includes this and include / import it on the respective Activities?