Note that there are some explanatory texts on larger screens.

plurals
  1. PODate picker dialog is not working in fragment
    primarykey
    data
    text
    <p><strong>here i have made a simple code for date picker which works for current date, year and day,it is not working for fragment</strong></p> <pre><code> public class Activity extends Sherlockfragment { EditText dob; public static final int DATE_DIALOG_ID = 1009; String dob_string; int year = 2013, month = 10, day = 1, dayofmonth = 1; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { view = inflater.inflate(R.layout.update_profile, container, false); mdob = (EditText)view. findViewById(R.id.dob); mdob.setOnClickListener(new View.OnClickListener() { @SuppressWarnings("deprecation") public void onClick(View v) { // TODO Auto-generated method stub showDialog(DATE_DIALOG_ID); }}); return view; } // ****************************#DATE PICKER DIALOG# ************************** @Override protected Dialog onCreateDialog(int id) { switch (id) { case DATE_DIALOG_ID: // set date picker as current date return new DatePickerDialog(this, datePickerListener, year, month, day); } return null; } private DatePickerDialog.OnDateSetListener datePickerListener = new DatePickerDialog.OnDateSetListener() { // when dialog box is closed, below method will be called. public void onDateSet(DatePicker view, int selectedYear, int selectedMonth, int selectedDay) { year = selectedYear; month = selectedMonth + 1; day = selectedDay; Calendar cal = Calendar.getInstance(); cal.set(selectedYear, selectedMonth, selectedDay); DateFormatSymbols dfs = new DateFormatSymbols(Locale.getDefault()); String weekdays[] = dfs.getWeekdays(); int daykk = cal.get(Calendar.DAY_OF_WEEK); String dayof = weekdays[daykk]; mdob.setText(day + "-" + month + "-" + year + dayof); mdob_string = day + "-" + month + "-" + year; }}; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload