1. Download our Official Android App: Forums for Android!

Apps How to use the strings from resource?

Discussion in 'Android Development' started by Bodom, Aug 8, 2009.

  1. Bodom

    Bodom Newbie
    Thread Starter
    Rank:
    None
    Points:
    15
    Posts:
    17
    Joined:
    Jul 6, 2009

    Jul 6, 2009
    17
    0
    15
    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 Newbie
    Thread Starter
    Rank:
    None
    Points:
    15
    Posts:
    17
    Joined:
    Jul 6, 2009

    Jul 6, 2009
    17
    0
    15
    Okay I found out.

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

Share This Page

Loading...