I'm doing a project in Android Studio using empty activities but in both of them the title still being the same, like in the image:
How can I change the title of the second activity to 'Form' instead of 'Agenda' as well?
I'm doing a project in Android Studio using empty activities but in both of them the title still being the same, like in the image:
How can I change the title of the second activity to 'Form' instead of 'Agenda' as well?
It is very easy. In every .class you want a different title in your actionbar, you only have yo setTitle. Like here:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setTitle("Your custom title");}
In you second activity in OnCreate
method add this line
getSupportActionBar().setTitle("Form");
Just do this.
Add this in your Form activity class onCreate method.
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeButtonEnabled(true);
actionBar.setTitle("Form");
call
setTitle("title")
onCreate, or u can set label in AdnroidManifest.xml file to activity:
<activity
android:name=".ActivityName"
android:label="custom label string"
android:theme="theme..." >
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>