Can't set meta data in manifest
<p>I tried to put a string into manifest and retrieve it. Unfortunately it doesn't work. It doesn't print anything instead of "hieutot". How to fix it?</p>

<pre><code>@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Log.d("HieuND", "TESSSSSSSSSSSS");

    setApplicationId(this, "hieutot");
    final String s = getMetadataApplicationId(this);
    Log.d("HieuND", s);


}

public static void setApplicationId(final Context context, final String applicationId) {
    try {
        final ApplicationInfo ai = context.getPackageManager().getApplicationInfo(
                context.getPackageName(), PackageManager.GET_META_DATA);
        if (ai.metaData != null) {
            ai.metaData.putString("test", applicationId);
        }
    } catch (final PackageManager.NameNotFoundException e) {
        throw new RuntimeException(e);
    }
}

public static String getMetadataApplicationId(final Context context) {
    try {
        final ApplicationInfo ai = context.getPackageManager().getApplicationInfo(
                context.getPackageName(), PackageManager.GET_META_DATA);
        if (ai.metaData != null) {
            final String s = ai.metaData.getString("test");
            Log.d("HieuND", "zz = " + s);
            return s;
        }
    } catch (final PackageManager.NameNotFoundException e) {
        // if we can't find it in the manifest, just return null
    }

    return null;
}
</code></pre>

<p>Manifest</p>

<pre><code>&lt;application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" &gt;
    &lt;activity
        android:name=".MainActivity"
        android:label="@string/title_activity_main" &gt;
        &lt;intent-filter&gt;
            &lt;action android:name="android.intent.action.MAIN" /&gt;
            &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
        &lt;/intent-filter&gt;
    &lt;/activity&gt;

    &lt;meta-data android:name="test" android:value=""/&gt;
&lt;/application&gt;
</code></pre>
