Example #1
0
  private void populateItem() {

    SimpleAdapter.ViewBinder viewBinder =
        new SimpleAdapter.ViewBinder() {

          public boolean setViewValue(View view, Object data, String textRepresentation) {
            // We configured the SimpleAdapter to create TextViews (see
            // the 'to' array, above), so this cast should be safe:
            TextView textView = (TextView) view;
            textView.setText(textRepresentation);
            return true;
          }
        };

    SimpleAdapter seasonAdapter =
        new SimpleAdapter(
            this,
            seasonList,
            android.R.layout.simple_spinner_item,
            new String[] {"seasonName"},
            new int[] {android.R.id.text1});
    seasonAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    seasonAdapter.setViewBinder(viewBinder);
    spnSeason.setAdapter(seasonAdapter);
    spnSeason.setPrompt(getString(R.string.select_season));

    SimpleAdapter typeAdapter =
        new SimpleAdapter(
            this,
            typeList,
            android.R.layout.simple_spinner_item,
            new String[] {"typeName"},
            new int[] {android.R.id.text1});
    typeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    typeAdapter.setViewBinder(viewBinder);
    spnType.setAdapter(typeAdapter);
    spnType.setPrompt(getString(R.string.select_type));

    SimpleAdapter statusAdapter =
        new SimpleAdapter(
            this,
            statusList,
            android.R.layout.simple_spinner_item,
            new String[] {"statusName"},
            new int[] {android.R.id.text1});
    statusAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    statusAdapter.setViewBinder(viewBinder);
    spnStatus.setAdapter(statusAdapter);
    spnStatus.setPrompt(getString(R.string.select_status));
  }
Example #2
0
  private void ReloadChapterList() {

    String chapterlist[] = getResources().getStringArray(R.array.chapterlist);

    String chapter[] = Common.tokenFn("-1," + chapterlist[mBook], ",");

    ArrayList<HashMap<String, String>> mList = new ArrayList<HashMap<String, String>>();

    for (int y = 0; y < chapter.length; y++) {
      HashMap<String, String> item = new HashMap<String, String>();

      if (y == 0) {
        item.put("Chapter", "ALL");
      } else {
        item.put("Chapter", chapter[y]);
      }

      mList.add(item);
    }

    SimpleAdapter adapter =
        new SimpleAdapter(
            getBaseContext(),
            mList,
            android.R.layout.simple_spinner_item,
            new String[] {"Chapter"},
            new int[] {android.R.id.text1});
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_item);
    Spinner chapter_spinner = (Spinner) findViewById(R.id.chapters);
    chapter_spinner.setAdapter(adapter);

    mChapter = 0;
    chapter_spinner.setSelection(mChapter);
    ReloadBibleContents();
  }