Problem displaying int


Last Updated:

  1. kvittering329

    kvittering329 New Member This Topic's Starter

    Joined:
    Sep 16, 2009
    Messages:
    1
    Likes Received:
    0
    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

    Joined:
    Jun 16, 2009
    Messages:
    9
    Likes Received:
    0
    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...