Example usage for android.widget DatePicker DatePicker

List of usage examples for android.widget DatePicker DatePicker

Introduction

In this page you can find the example usage for android.widget DatePicker DatePicker.

Prototype

public DatePicker(Context context) 

Source Link

Usage

From source file:MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    RelativeLayout layout = (RelativeLayout) findViewById(R.id.layout);
    DatePicker datePicker = new DatePicker(this);
    layout.addView(datePicker);/*from www. ja v a2 s  .  c o m*/
}

From source file:cz.tsystems.portablecheckin.MainActivity.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.activity_main, container, false);

    values1 = (RelativeLayout) rootView.findViewById(R.id.mainValuelayout1);
    values2 = (RelativeLayout) rootView.findViewById(R.id.mainValuelayout2);

    theDatePicker = new DatePicker(getActivity());
    txtRZV = (BaseEditText) values1.findViewById(R.id.txtSPZ);
    txtRZV.setOnEditorActionListener(rzvOnEditorActionListener);
    EditText edtTmp = (EditText) values2.findViewById(R.id.txtVIN);
    txtVIN = (vinEditText) edtTmp;//from  w  w w.  j a  v  a 2s  .  c  om
    txtVIN.setOnEditorActionListener(vinEditorActionListener);

    txtZakaznik = (BaseEditText) values2.findViewById(R.id.txtZakaznik);
    txtVozPristavil = (BaseEditText) values2.findViewById(R.id.txtVozPristavil);
    txtStavTachometru = (BaseEditText) values2.findViewById(R.id.txtStavTachomeru);
    txtSTKDate = (BaseEditText) values1.findViewById(R.id.txtSTK);
    txtEmiseDate = (BaseEditText) values2.findViewById(R.id.txtEmise);
    txtPredajDate = (BaseEditText) values1.findViewById(R.id.txtPredajDat);
    txtModelYear = (BaseEditText) values1.findViewById(R.id.txtModelYear);
    spScenare = (Spinner) values1.findViewById(R.id.spScenar);
    spTypPaliva = (Spinner) values1.findViewById(R.id.spTypPaliva);

    txtRZV.addTextChangedListener(textWatcher);
    txtVIN.addTextChangedListener(textWatcher);
    txtZakaznik.addTextChangedListener(textWatcher);
    txtVozPristavil.addTextChangedListener(textWatcher);
    txtStavTachometru.addTextChangedListener(textWatcher);
    txtSTKDate.addTextChangedListener(textWatcher);
    txtEmiseDate.addTextChangedListener(textWatcher);

    txtRZV.setOnFocusChangeListener(onFocusChangeListener);
    txtVIN.setOnFocusChangeListener(onFocusChangeListener);
    txtZakaznik.setOnFocusChangeListener(onFocusChangeListener);
    txtVozPristavil.setOnFocusChangeListener(onFocusChangeListener);
    txtStavTachometru.setOnFocusChangeListener(onFocusChangeListener);
    txtSTKDate.setOnFocusChangeListener(onFocusChangeListener);
    txtEmiseDate.setOnFocusChangeListener(onFocusChangeListener);

    scenarClicked = false;
    spScenare.setOnItemSelectedListener(scenarSelectedListener);
    spScenare.setOnTouchListener(scenarOnTouchListener);

    btnSPZ = (Button) values1.findViewById(R.id.btnSPZ);
    btnSTK = (Button) values1.findViewById(R.id.btnSTK);
    btnEmise = (Button) values2.findViewById(R.id.btnEmise);
    btnDatumProdeje = (Button) values1.findViewById(R.id.btnProdejDat);
    btnModelYear = (Button) values1.findViewById(R.id.btnModelYearDate);

    chkPoistPrip = (Switch) values1.findViewById(R.id.chkPoist_prp);
    chkOtp = (Switch) values1.findViewById(R.id.chkOTP);
    chkServisKniz = (Switch) values2.findViewById(R.id.chkServisKnizka);

    stavPaliva = (Slider) values1.findViewById(R.id.slaiderStavPaliva);
    stavInterieru = (Slider) values2.findViewById(R.id.slaiderInterier);
    stavOleja = (Slider) values2.findViewById(R.id.slaiderStavOleje);

    fbtPZ = (ButtonFloat) rootView.findViewById(R.id.fbtnPZ);
    fbtPZ.setOnClickListener(theFloatButtonClickLisener);
    fbtMajak = (ButtonFloat) rootView.findViewById(R.id.fbtnMajak);
    fbtMajak.setOnClickListener(theFloatButtonClickLisener);
    fbtMegafon = (ButtonFloat) rootView.findViewById(R.id.fbtnMegafon);
    fbtMegafon.setOnClickListener(theFloatButtonClickLisener);

    setEnableButton(fbtPZ, false);
    setEnableButton(fbtMajak, false);
    setEnableButton(fbtMegafon, false);

    return rootView;
}