Android: Changing the Title of an Activity – setTitle works – android:label does not?

To change the title of an activity (to show a more custom title for a certain activity than the application title), you can set the new title either through calling setTitle("foo") on the activity or by setting android:label="@string/price_after_rebate" in your activity style.

The problem was that the latter didn’t work, while the first one did. I try to keep any static definitions related to the activities outside of the code itself, but that’s hard when it doesn’t work as expected.

Turns out that if there’s a title set in the AndroidManifest.xml file (located under app/manifests/ in the standard layout / Android Studio), it’ll override any title set elsewhere in the definitions. You can change the specific titles by setting android:label="@string/price_after_rebate" on the activity definitions in the manifest instead of the activity xml file:

<activity
    android:name=".xyz.Foo"
    android:parentActivityName=".MainActivity"
    android:label="@string/xyz_foo_activity_title"
>
    <meta-data
        android:name="android.support.PARENT_ACTIVITY"
        android:value="xyz.MainActivity" />
</activity>

NetBeans with NBandroid, Emulator Never Shows After Building/Running With F6

Trying to build my first (or second, I tend to forget) Android project under NetBeans, I ran into an issue where the emulator would never show up when I tried to build the project. Turns out I even got a null pointer exception which I thought were generated somewhere else in NetBeans (next time: read the actual exception and don’t assume).

The solution to fix the emulator never showing up? Update the currently installed version of the JDK. (Thanks to a Stackoverflow thread for hinting in the correct direction) Remember that NetBeans might be tied to a particular version of the JDK (either in the command line arguments or in netbeans.conf in the etc/ directory of the NetBeans installation directory). I uninstalled any older version, which gave me an error about the value of jdkhome being wrong, and asking if I wanted to use the default path instead. That worked, but the error shows up each time. Comment out the jdkhome-line in netbeans.conf and it’ll guess automagically each time (if guessing works for you), or if guessing doesn’t work, add the new path to the JDK in netbeans.conf.