Мое приложение успешно работает на эмуляторе и фискальных устройствах, но после того, как я собрал APK и установил его на свое устройство, при открытии средства выбора даты приложение вылетает и останавливается.
@SuppressLint("ValidFragment")
class DatePickerFragment extends DialogFragment
implements DatePickerDialog.OnDateSetListener {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Use the current date as the default date in the picker
final Calendar c = Calendar.getInstance();
int year = c.get(Calendar.YEAR);
int month = c.get(Calendar.MONTH);
int day = c.get(Calendar.DAY_OF_MONTH);
// Create a new instance of DatePickerDialog and return it
return new DatePickerDialog(getActivity(), R.style.CustomDateTimeDialog, this, year, month, day);
}
public void onDateSet(DatePicker view, int year, int month, int day) {
// Do something with the date chosen by the user
String mese;
switch(month+1){
case 1: mese="Gennaio";dateEditText.setText(day+" "+mese+" "+year);break;
case 2: mese="Febbraio";dateEditText.setText(day+" "+mese+" "+year);break;
case 3: mese="Marzo";dateEditText.setText(day+" "+mese+" "+year);break;
case 4: mese="Aprile";dateEditText.setText(day+" "+mese+" "+year);break;
case 5: mese="Maggio";dateEditText.setText(day+" "+mese+" "+year);break;
case 6: mese="Giugno";dateEditText.setText(day+" "+mese+" "+year);break;
case 7: mese="Luglio";dateEditText.setText(day+" "+mese+" "+year);break;
case 8: mese="Agosto";dateEditText.setText(day+" "+mese+" "+year);break;
case 9: mese="Settembre";dateEditText.setText(day+" "+mese+" "+year);break;
case 10: mese="Ottobre";dateEditText.setText(day+" "+mese+" "+year);break;
case 11: mese="Novembre";dateEditText.setText(day+" "+mese+" "+year);break;
case 12: mese="Dicembre";dateEditText.setText(day+" "+mese+" "+year);break;
}
}
}