List of usage examples for android.app DatePickerDialog setCustomTitle
public void setCustomTitle(View customTitleView)
From source file:ca.marcmeszaros.papyrus.browser.BooksBrowser.java
protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { switch (requestCode) { // LOAN A BOOK case 1001: // there are sufficient copies of the book to lend if (canLoanBook()) { loanData = data;/*from w w w . j a va2s .co m*/ // set default due date final Calendar c = Calendar.getInstance(); c.setTimeInMillis(System.currentTimeMillis() + (1000 * 60 * 60 * 24 * 14)); int mYear = c.get(Calendar.YEAR); int mMonth = c.get(Calendar.MONTH); int mDay = c.get(Calendar.DAY_OF_MONTH); // create the custom dialog title view block LinearLayout linearLayout = (LinearLayout) getLayoutInflater() .inflate(R.layout.datepickerdialog_customtitle_twoline, null); TextView title = (TextView) linearLayout .findViewById(R.id.DatePickerDialog_customTitle_twoline_title); TextView titleDescription = (TextView) linearLayout .findViewById(R.id.DatePickerDialog_customTitle_twoline_description); // set the text title.setText(R.string.AlertDialog_LoanReturnDateDialog_title); titleDescription.setText(R.string.AlertDialog_LoanReturnDateDialog_titleDescription); // create the dialog with the custom header and display it DatePickerDialog dialog = new DatePickerDialog(this, mDateSetListener, mYear, mMonth, mDay); dialog.setCustomTitle(linearLayout); dialog.show(); } else { // there are no more copies left in the library Toast.makeText(this, getString(R.string.BooksBrowser_toast_allCopiesLentOut), Toast.LENGTH_LONG) .show(); } break; } } else { // gracefully handle failure // Log.w(DEBUG_TAG, "resultWarning: activity result not ok"); } }