@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_job_form);

    final ViewDataBinding binding =
        DataBindingUtil.setContentView(this, R.layout.activity_job_form);
    binding.setVariable(com.firebase.jobdispatcher.testapp.BR.form, form);

    View.OnClickListener onScheduleButtonClickListener =
        new ScheduleButtonClickListener(
            form, new FirebaseJobDispatcher(new GooglePlayDriver(this)));

    AppCompatButton scheduleButton = (AppCompatButton) findViewById(R.id.schedule_button);
    assert scheduleButton != null;

    scheduleButton.setOnClickListener(onScheduleButtonClickListener);

    uriSpinner = setUpSpinner(R.id.uri_spinner, R.array.uri_array);

    triggerSpinner = setUpSpinner(R.id.trigger_spinner, R.array.trigger_array);

    final LinearLayout timePanel = (LinearLayout) findViewById(R.id.timePanel);
    timePanel.setVisibility(View.GONE);

    final LinearLayout uriPanel = (LinearLayout) findViewById(R.id.uriPanel);
    uriPanel.setVisibility(View.GONE);
    triggerSpinner.setOnItemSelectedListener(
        new AdapterView.OnItemSelectedListener() {
          @Override
          public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            switch (TriggerType.getByPosition(position)) {
              case TIMED_TRIGGER:
                timePanel.setVisibility(View.VISIBLE);
                uriPanel.setVisibility(View.GONE);
                break;
              case CONTENT_URI_TRIGGER:
                timePanel.setVisibility(View.GONE);
                uriPanel.setVisibility(View.VISIBLE);
                break;
              case NOW_TRIGGER:
                timePanel.setVisibility(View.GONE);
                uriPanel.setVisibility(View.GONE);
                break;
              default:
                Log.e(TAG, "Unknown trigger was selected.");
                break;
            }
          }

          @Override
          public void onNothingSelected(AdapterView<?> parent) {}
        });
  }
An Activity that shows a form UI allowing users to define a custom job.
testapp/src/main/java/com/firebase/jobdispatcher/testapp/JobFormActivity.java