I'm sure this is simple but I'm new to Android development and can't find the answer.
On my main screen I have a number of TextViews that I update when data arrives - this works fine when the app first starts.
The problem arises when I open a menu to change a setting. On returning from the menu the TextViews no longer update.
I see that onCreate is called when I return from the menu and so I'm guessing the problem is that the references to the TextViews are being changed however as I'm using the reference it doesn't make sense that the TextView doesn't update.
In onCreate I have:
txtStartPower = (TextView) findViewById(R.id.txtPowerStart);
then to update I use:
txtStartPower.setText(Integer.toString(startW));
In my AndroidManifest.xml for the settings I have:
<activity android:name=".SettingsActivity"
android:parentActivityName=".MainActivity"
android:label="Settings">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity" />
</activity>
and in the menu selection code I have:
public boolean onOptionsItemSelected(MenuItem item) {
switch(item.getItemId()) {
case R.id.action_settings:
Intent sIntent = new Intent(this, SettingsActivity.class);
startActivity(sIntent);
return true;
}
return(super.onOptionsItemSelected(item));
}
Any help please...