I am getting date from the calender and converting its format using
SimpleDateFormat sdf1 = new SimpleDateFormat("MM/dd/yyyy");
Date date = null;
try {
date = sdf1.parse(datevalue);
} catch (ParseException e) {
e.printStackTrace();
}
if(date != null) {
Date d = new Date(date.getTime());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
return sdf.format(d);
}
return "";
But I am getting crash on some of devices and for some devices it is working fine.
I don't know why it is happening on some devices only.
I am getting this in Fabric report:
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
at java.text.SimpleDateFormat.parse(SimpleDateFormat.java:1044)
at java.text.DateFormat.parse(DateFormat.java:577)
at com.app.appUtilities.Utilities.convertDateFormat(Utilities.java:34)
Please help me out.