How to change android Activity label

You can define the string in res/string.xml file and then add android:label to the AndroidMenifest.xml file

string.xml code
<string name="string_name">text to display</string>

AndroidMenifest.xml code

<activity android:name=".SomeActivity"
            android:label="@string/string_name"/>

Use

setTitle(int titleId)

or

setTitle(CharSequence title)

public class YourActivity extends Activity {
  @Override
  public void onCreate(Bundle savedInstanceState) {
      setTitle(R.string.your_title);
      setContentView(R.layout.main);
  }
}

You need to use setTitle for this:

setTitle(R.string.your_title);
//or
setTitle("new title");