protected void initVideoSpinners() {
    ArrayAdapter<CharSequence> adapter;

    // Video parameters spinners
    frameSizeSpinner = (Spinner) findViewById(R.id.frameSize_spinner);
    adapter =
        ArrayAdapter.createFromResource(
            this, R.array.frame_size_values, android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    frameSizeSpinner.setAdapter(adapter);
    frameSizeSpinner.setOnItemSelectedListener(
        new AdapterView.OnItemSelectedListener() {
          @Override
          public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
            String[] frameSizeContainer =
                frameSizeSpinner.getSelectedItem().toString().split("x", 2);
            videoWidthOut = Integer.valueOf(frameSizeContainer[0].trim());
            videoHeightOut = Integer.valueOf(frameSizeContainer[1].trim());
          }

          @Override
          public void onNothingSelected(AdapterView<?> adapterView) {}
        });

    videoBitRateSpinner = (Spinner) findViewById(R.id.videoBitRate_spinner);
    adapter =
        ArrayAdapter.createFromResource(
            this, R.array.video_bit_rate_values, android.R.layout.simple_spinner_item);
    videoBitRateSpinner.setAdapter(adapter);
    videoBitRateSpinner.setOnItemSelectedListener(
        new AdapterView.OnItemSelectedListener() {
          @Override
          public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
            videoBitRateInKBytes =
                Integer.valueOf(videoBitRateSpinner.getSelectedItem().toString());
          }

          @Override
          public void onNothingSelected(AdapterView<?> adapterView) {}
        });
  }
Exemplo n.º 2
0
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.masstab);

    spinnerFrom = (Spinner) findViewById(R.id.SpinnerFrom);
    ArrayAdapter<CharSequence> adapter =
        ArrayAdapter.createFromResource(
            this, R.array.weights, android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinnerFrom.setAdapter(adapter);

    spinnerTo = (Spinner) findViewById(R.id.SpinnerTo);
    spinnerTo.setAdapter(adapter);

    final Button button = (Button) findViewById(R.id.Go_Button);
    button.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            calculate();
          }
        });
  }