Ejemplo n.º 1
0
 private void populatePositionsSpinner() {
   JSONArray positions = database.getPositions();
   ArrayList positionsSpinnerFormat = new ArrayList();
   JSONObject positionElement;
   for (int i = 0; i < positions.length(); i++) {
     try {
       positionElement = (JSONObject) positions.get(i);
       positionsSpinnerFormat.add(positionElement.get("name"));
     } catch (JSONException e) {
       e.printStackTrace();
     }
   }
   positionSpinnerAdapter =
       new ArrayAdapter<String>(
           this, android.R.layout.simple_spinner_dropdown_item, positionsSpinnerFormat);
   oPositionSpinner.setAdapter(positionSpinnerAdapter);
 }