Cjsparrow
Cjsparrow

Reputation: 69

Rename an activity

I have added an empty activity in option menu settings. When I am clicking on settings an activity opens, named My Application, which is my application name. I want the name to be Settings. Can anyone help? I'm using Android studio.

Upvotes: 3

Views: 12804

Answers (5)

Thant Sin Aung
Thant Sin Aung

Reputation: 722

  1. Open AndroidManifest.xml
  2. Find your activity declaration and add android:label="Settings" to activity tag.
<activity
    android:name=".SettingsActivity"
    android:label="@string/settings_label"
    android:screenOrientation="portrait"
    android:theme="@style/AppTheme" />

Upvotes: 1

Ezio
Ezio

Reputation: 2985

Select the activity name in the project explorer and press "Shift + F6" (in windows) or "CMD + F6" (in mac). A dialog will come, give new name to that activity and press OK. This will make changes in all the required places.

Upvotes: 0

Vinay
Vinay

Reputation: 767

set your activity title using this code:

Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setTitle("My title");

Upvotes: 1

GAGAN BHATIA
GAGAN BHATIA

Reputation: 601

Click on the activity file from the project structure. Press "Shift + F6 ", you will be asked to rename the activity. Enter the new name and press Enter. Hope this helps.

Upvotes: 2

A.Shaheri
A.Shaheri

Reputation: 450

take a look at your androidManifest.xml configuration.

Upvotes: 2

Related Questions