1. Check out our companion app, Forums for Android! Download from Google Play

How to use the strings from resource?

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

  1. Bodom

    Bodom Member
    Thread Starter
    15

    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 Member
    Thread Starter
    15

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

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

Share This Page

Loading...