How do you add user defined properties/values in to the Android manifest file?

I want to add a custom attribute / property into the manifest file, and be able to read it at run time. I want to do this so I can customize the app’s behavior via these manifest properties. How can this be done?

How do I add an intent-filter to a Flex android project manifest?

I have a Flex-app.xml. The actual manifest in the apk file seems to be created off of this xml file. I wish to add an intent-filter to the manifest. How do I do this?

Read Android Manifest file using Java Code

I want to parse Android manifest file using java code(not through Android code) and do some changes in that manifest file. How can I do that??

How do you get the user defined “Device Name” in android?

I am trying to get the user defined device name that is set in settings. I’ve tried several options and so far nothing. If it helps or hurts I am needing it in a BroadcastReceiver Thanks

Reading android manifest file

Is there any way we can read/parse android manifest file as we do it for files in raw folder as mentioned here: http://eagle.phys.utk.edu/guidry/android/writeSD.html getResources.ReadManifest..somet

how to add UAC manifest file to vb.net

How can I add and embed manifest file in VB.net, in order to add UAC support to my application.

Android do activities require a manifest file?

So I was wondering if adding multiple activities in my app, do each require a manifest xml file or whatever? I tried switching activities without it and it crashed. Then I added the other activity and

How do you setup tab settings for user defined file types in notepad++?

I’m trying to setup Notepad++ to be able to edit a particular source-code file (*.mrc / mIRC Scripting File). The only thing I can’t figure out is how to set the tab settings to 3 spaces. I’ve searche

How to set Text Appearance in Android manifest file?

Is it possible to do the equivalent of setTextAppearance(context, android.R.style.TextAppearance_Medium); in the manifest file for an Android app?

How can I read the app version defined in the manifest file programmically?

In the Android manifest file, there is a field that specifies the application version. How I can read that value programmically?

How do I set the intent of menu items defined in an Android menu xml file?

How do I set the intent of menu items defined in an Android menu xml file? For example I currently have… <menu xmlns:android=http://schemas.android.com/apk/res/android android:name=Main Menu&

Answers

You can create an empty resource file in res/values and add strings and items (for bool or integer values) to it.

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="foo">bar</string">
    <item name="testint" type="integer">33</item>
    <item name="testbool" type="bool">true</item>
</resources>

Alternatively you could simply use a Constants object in which you define your properties as final static variables.

You can add meta-data to your AndroidManifest.xml file and then read that in your application.

Write the data like so:

<meta-data android:value="bar" android:name="foo"></meta-data>

And read the data like so:

ai = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA);
Object value = (Object)ai.metaData.get("foo");

See http://developer.android.com/guide/topics/manifest/meta-data-element.html