0

enter image description hereI tried with below code, but the labels of different screens are missing and not visible in User Interface and Can you tell me how to solve this issue

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.geeth.myprofile">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity"
                  android:label="My Profile">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".ProfilePhoto"
                  android:label="My Profile Picture"></activity>
    </application>

</manifest>

See below Image I am getting output like this,I request you is there any corrections required in above code

  • Did you mean the title "My profile" and "My profile picture" – Jyoti JK Mar 20 '18 at 05:14
  • Possible duplicate of [How do I change the android actionbar title and icon](https://stackoverflow.com/questions/14483393/how-do-i-change-the-android-actionbar-title-and-icon) – AskNilesh Mar 20 '18 at 05:24

2 Answers2

1

did you mean Activity title? then you can use this

setTitle("Your Title");

or if you use toolbar use

getSupportActionBar().setTitle("Your Title");`

or via AndroidManifest

android:label="My Activity Title"
himel
  • 500
  • 5
  • 14
  • It's about Activity Title and Can I know how to change titles for each and every screen by means of AndroidManifest. I have Three Screens as Follows 1)My Profile 2)My Profile Picture 3)Education – Mandava Geethabhargava Mar 20 '18 at 05:26
  • then just use android:label="My Activity Title" in manifest of the activity tag of every activity you want . – himel Mar 20 '18 at 05:27
  • I tried , Once see above Code I kept as you told in above code and can you suggest in above code – Mandava Geethabhargava Mar 20 '18 at 05:30
  • please post your activity oncreate code as well, I think there might be some code in your activity which is overriding title from manifest – Shaz Hemani Mar 20 '18 at 05:49
0

This is very simple to accomplish

If you want to change it in code, call:

setTitle("My title"); OR

getSupportActionBar().setTitle("My title");

And set the values to whatever you please.

Or, in the Android manifest XML file:

<activity android:name=".MyActivity"  
       android:label="My title" />

The code should all be placed in your onCreate so that the label/icon changing is transparent to the user, but in reality it can be called anywhere during the activity's lifecycle.

Community
  • 1
  • 1
Rahul
  • 3,293
  • 2
  • 31
  • 43