コード例 #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.setContentView(R.layout.measurement_creation_main);

    assert (this.getParent().getClass().getName().compareTo("SpeedometerApp") == 0);
    this.parent = (SpeedometerApp) this.getParent();

    /* Initialize the measurement type spinner */
    Spinner spinner = (Spinner) findViewById(R.id.measurementTypeSpinner);
    spinnerValues = new ArrayAdapter<String>(this.getApplicationContext(), R.layout.spinner_layout);
    for (String name : MeasurementTask.getMeasurementNames()) {
      spinnerValues.add(name);
    }
    spinnerValues.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinner.setAdapter(spinnerValues);
    spinner.setOnItemSelectedListener(new MeasurementTypeOnItemSelectedListener());
    spinner.requestFocus();
    /* Setup the 'run' button */
    Button runButton = (Button) this.findViewById(R.id.runTaskButton);
    runButton.setOnClickListener(new ButtonOnClickListener());

    this.measurementTypeUnderEdit = PingTask.TYPE;
    setupEditTextFocusChangeListener();

    this.udpDir = "Up";

    final RadioButton radioUp = (RadioButton) findViewById(R.id.UDPBurstUpButton);
    final RadioButton radioDown = (RadioButton) findViewById(R.id.UDPBurstDownButton);

    radioUp.setChecked(true);
    radioUp.setOnClickListener(new RadioOnClickListener());
    radioDown.setOnClickListener(new RadioOnClickListener());
  }
コード例 #2
0
  public void update_member(View v) {
    if (edtFname.getText().toString().equals("")) {
      edtFname.requestFocus();
      Toast.makeText(Profile_Edit.this, "Please enter First name", Toast.LENGTH_LONG).show();
      return;
    }
    if (edtLname.getText().toString().equals("")) {
      edtLname.requestFocus();
      Toast.makeText(Profile_Edit.this, "Please enter Last name", Toast.LENGTH_LONG).show();
      return;
    }
    if (gender.equals("")) {

      Toast.makeText(Profile_Edit.this, "Please select the gender", Toast.LENGTH_LONG).show();
      return;
    }
    if (birth_info.equals("")) {
      Toast.makeText(Profile_Edit.this, "Please select Dob/Age/Unborn", Toast.LENGTH_LONG).show();
      return;
    }
    if (birth_info.equals("age") && edtAge.getText().equals("")) {
      edtAge.requestFocus();
      Toast.makeText(Profile_Edit.this, "Please enter Age", Toast.LENGTH_LONG).show();
      return;
    }
    if ((birth_info.equals("dob") || birth_info.equals("unborn"))
        && spYear.getSelectedItemPosition() == 0) {
      spYear.requestFocus();
      Toast.makeText(Profile_Edit.this, "Please select year", Toast.LENGTH_LONG).show();
      return;
    }
    if ((birth_info.equals("dob") || birth_info.equals("unborn"))
        && spMonth.getSelectedItemPosition() == 0) {
      spMonth.requestFocus();
      Toast.makeText(Profile_Edit.this, "Please select month", Toast.LENGTH_LONG).show();
      return;
    }
    if ((birth_info.equals("dob") || birth_info.equals("unborn"))
        && spDay.getSelectedItemPosition() == 0) {
      spDay.requestFocus();
      Toast.makeText(Profile_Edit.this, "Please select day", Toast.LENGTH_LONG).show();
      return;
    }
    new UpdateMember().execute();
  }