1. Are you ready for the Galaxy S20? Here is everything we know so far!

Two questions

Discussion in 'Android Development' started by ondrovic, Dec 25, 2011.

  1. ondrovic

    ondrovic Newbie
    Thread Starter

    First if I have this setup and want to only do something if debug is set to true how do I do it?
    Code (Text):
    1. <bool name="debug">false</bool>
    Second I want to setup a multidimensional array using a spinner that holds details and price per selection

    example:
    Code (Text):
    1.  
    2. Name="Name of feature"
    3. Price="Price of feature"
    4.  
    any ideas? Thanks
     



    1. Download the Forums for Android™ app!


      Download

       
  2. jiminaus

    jiminaus Well-Known Member

    Use the Java XML API in javax.xml.* to read in the file and use a XPath query to find the value of the bool node whose name attribute is debug. This would be an expensive operation, so only do it once and then cache the result.

    I'll assume you've, at the very least, already gone through the Hello, Spinner tutorial.

    You want some kind of SpinnerAdapter. You could implement one yourself directly by subclassing BaseAdapter. Alternatively transform your data so you can use one of the provided subclasses of BaseAdapter, such as ArrayAdapter.

    (Ahh, [THREAD=470677]looks like[/THREAD] you'd already figured that out.)
     
    ondrovic likes this.
Loading...

Share This Page

Loading...