Results 1 to 2 of 2
  1. #1

    how to access strings in a custom xml file in res/values?

    I have this file in res/values. Say it's X.xml where I have some strings inside:

    <?xml version="1.0" encoding="utf-8"?>
    <resources>

    <!--
    wether we are on a release or not
    Values: true or false
    -->
    <string name="release">false</string>
    <string name="base_uri">http://blahblah</string>

    <!-- for testing purposes -->
    <string name="default_username">username</string>
    <string name="default_password">password</string>

    </resources>

    How can I access those values in code? Thanks in advance.

    How can I access a plain text interface to create a post so that I can create blocks?

  2. #2
    All values can be accessed in code by autogenerated com.yourpackage.R class, for example R.strings.default_username, in Context class exists methods such as getStringResource (cant rememeber corret name right now) which can return your string by providing id of string from R.strings class



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •