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

Problem displaying int

Discussion in 'Application Development' started by kvittering329, Sep 16, 2009.

  1. kvittering329

    kvittering329 New Member
    Thread Starter
    5

    Sep 16, 2009
    1
    0
    5
    I can't display an integer in xml. Strings work fine, but how does integers work?

    Appreciate any tips or help.

    Thanks. :)
     

    Advertisement

  2. arnodenhond

    arnodenhond Member
    25

    Jun 16, 2009
    9
    0
    25
    Android Consultant
    Netherlands
    Are you taking about the strings.xml file?
    If so, all lines in there should always only be of type string.

    You could type your number as a string then in your code, use
    Code (Text):
    1. Integer.parseInt(getString(R.string.myintasastring))
    to convert it.

    However, the strings.xml file is intended to be used to make it easy to translate your apps.
    A better solution would be to have a generic xml file (in the xml subdirectory) or a data file (in the assets directory).
     

Share This Page

Loading...