How to use the strings from resource?


Last Updated:

  1. Bodom

    Bodom Member This Topic's Starter

    Joined:
    Jul 6, 2009
    Messages:
    17
    Likes Received:
    0
    Hi everyone,

    I have a problem, when I want to use the strings from string.xml.

    I tried something like this:

    int result = 1;
    String mystr = "some text" + result + R.string.myresstring;

    But in the new string mystr is not the String from R.string.myresstring, there is the integer id from the resource.

    But how can I acces the String behind this int id? I hope you understand what I mean ;D
     

    Advertisement
  2. Bodom

    Bodom Member This Topic's Starter

    Joined:
    Jul 6, 2009
    Messages:
    17
    Likes Received:
    0
    Okay I found out.

    getApplicationContext().getResources.getString(R.string.myresstring);
     

Share This Page

Loading...