public void run() {
          ArrayAdapter<String> a =
              new ArrayAdapter<String>(s.getContext(), android.R.layout.simple_spinner_item);
          for (int i = 0; i < stations.length; i++) a.add(stations[i][0]);

          a.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
          s.setAdapter(a);
        }
  private void initializeGui() {

    loading = 2;

    timeb = (TimeButton) findViewById(R.id.trips2TimeBut);
    timeb.setTime(getIntent().getExtras().getString("Time"));
    timeb.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View arg0) {
            showDialog(0);
          }
        });

    dateb = (DateButton) findViewById(R.id.trips2DateBut);
    dateb.setDate(getIntent().getExtras().getString("Date"));
    dateb.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View arg0) {
            showDialog(1);
          }
        });

    prodb = (ProductsButton) findViewById(R.id.trips2ProdBut);
    prodb.setProductString(getIntent().getExtras().getString("Products"));
    prodb.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View arg0) {
            showDialog(2);
          }
        });

    onDataLoaded dl =
        new onDataLoaded() {
          @Override
          public void dataLoaded() {
            loading--;
            if (loading == 0) progressDialog.dismiss();
          }
        };

    depEdit = (StationSpinner) findViewById(R.id.trips2Dep);
    arrEdit = (StationSpinner) findViewById(R.id.trips2Arr);

    depEdit.setOnDataLoaded(dl);
    arrEdit.setOnDataLoaded(dl);

    progressDialog =
        ProgressDialog.show(Trips2Activity.this, "Czekaj...", "Wyszukiwanie stacji...", true);

    Bundle extra = getIntent().getExtras();
    if (extra.containsKey("depSID"))
      depEdit.setUserInput(extra.getString("depText"), extra.getString("depSID"));
    else depEdit.setUserInput(extra.getString("depText"));

    if (extra.containsKey("arrSID"))
      arrEdit.setUserInput(extra.getString("arrText"), extra.getString("arrSID"));
    else arrEdit.setUserInput(extra.getString("arrText"));

    Button ok = (Button) findViewById(R.id.trips2OK);
    ok.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View arg0) {
            Intent ni = new Intent(arg0.getContext(), ConnectionsActivity.class);

            ni.putExtra("Time", timeb.getTime());
            ni.putExtra("Date", dateb.getDate());
            ni.putExtra("Products", prodb.getProductString());
            ni.putExtra("ZID", arrEdit.getCurrentSID());
            ni.putExtra("SID", depEdit.getCurrentSID());

            startActivity(ni);
          }
        });
  }