I am getting ODATA from SMP from that ODATA. When we are trying to fetch Datetime and setting into Java Date getting an Exception. How to Typecast ODATA DateTime to Java Date in Android (SMP 9.0 and above)?
After three hours of search I got the expected solution from SAP Community blog
Actually I was trying below one
if (property !=null) {
ObjName.setDate((Date)property.getValue());
}
But I was getting exception due to in proper Typecast.
We need to Typecast ODATA Edm.DateTime with GregorianCalendar in Android like
if (property !=null) {
ObjName.setDate( (GregorianCalendar) property.getValue());
}
Note:In above code setDate() is setter method.
For Detail Description :
http://scn.sap.com/community/developer-center/mobility-platform/blog/2015/08/15/handling-datetime-from-frontend-with-odata-in-native-android-app-using-smp-30][1]