title: Populate Spinner from CSV File using Scanner
body: <p>Using Android (Eclipse) I am trying to read a .csv file and dynamically
  populate a Spinner using Scanner. Have tried many methods with the same result.
  Emulator shows Spinner but only the last comma and price are populated. Also need to
  store all three variables in array and retrive them when Spinner selection is made
  in order to populate EditText fields. Any assistance would be greatly appreciated...</p>
  
  <p>Data file records:</p>
  
  <p>4,Aluminum Cans,.55   5,Vehicle with cat convertor,9.00   18,Brass ( Irony Red/Yellow ),.20      1001,<em>Deduction</em>  Customer # Look-Up,-2.00</p>
  
  <p>Java:</p>
  
  <pre><code>public class BRprogramActivity extends Activity {
      private static final String TAG = null;
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
          //
          Button addButton;
          Button editButton;
          Button sendButton;
          //  
          Spinner array_spinner;
          //
          //      activate soft Keyboard
          this.getWindow().setSoftInputMode
          (WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); 
          //
          //      .csv comma separated values file
          //        
          try {
              Scanner scanner = new Scanner(getResources().openRawResource(R.raw.brdata));  
              //         
              while (scanner.hasNext()) {
                  String data = (scanner.next());
                  String [] values = data.split(",");
                  item = values[0];              
                  description = values[1];
                  price = values[2];    
                  //  
                  array_spinner = (Spinner)findViewById(R.id.spinner1);         
                  ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;
                  (this,android.R.layout.simple_spinner_item,values);
                  array_spinner.setAdapter(adapter); 
              }       
              scanner.close();
  
          }   catch (Exception e) {
              Log.e(TAG, "Exception: "+Log.getStackTraceString(e));
          }
          //
          addButton = (Button) findViewById(R.id.addbutton);
  
          addButton.setOnClickListener(new OnClickListener(){
              public void onClick(View v){
                  Log.v("test", "ADD button clicked");
              }
          });
          //
          editButton = (Button) findViewById(R.id.editbutton);
  
          editButton.setOnClickListener(new OnClickListener(){
              public void onClick(View v){
                  Log.v("test", "EDIT button clicked");
              }
          });    
          //
          sendButton = (Button) findViewById(R.id.sendbutton);
  
          sendButton.setOnClickListener(new OnClickListener(){
              public void onClick(View v){
                  Log.v("test", "SEND button clicked");
              }
          });
      }
  }  
  </code></pre>