Sunday, 20 September 2020

XML getting values from another XML file

I am trying to build an android application that uses the Google Map API and I want to put this project on GIT. So I have an API key and this information is inside AndroidManifest.xml like this (I have replaced my actual API key with *key* here

<meta-data
android:name="com.google.android.geo.API_KEY"
android:value= *key* />

I don't want this sensitive information pushed on git, but I can't gitignore this file. Is it possible to make another XML file that has the secret key and make the AndroidManfiest.xml get it from there (so that I can gitignore this one)?

AndroidManifest.xml has this bit of code

<activity
android:name=".MapsActivity"
android:label="@string/title_activity_maps"
android:launchMode="singleTop" />

And I noticed that the label property gets its value from another XML file that's located in res/values/strings.xml so:

  1. how does AndroidManifest.xml know where to find the value for label
  2. what does the @ mean?
  3. can I put a XML file (called Config.xml) anywhere? or does it have to be in the res folder?


from XML getting values from another XML file

No comments:

Post a Comment