cancel
Showing results for 
Search instead for 
Did you mean: 

Date field is not populating to android native app.

midhun_vp
Active Contributor
0 Kudos

Hi,

I have an MBO in which there are two fields with datatype "date".

When I write android native code how can I manage it?

I am able to bring other fields to the device but the date fields are null.

Given below is the code used in the android.

for(Past_Substitutions itemheader : Past_Substitutions.findAll())

                                {

                                          item = new PastSubstitutionsBO();

                                          item.setEMAIL(itemheader.getEMAIL());

                                          item.setEND_DATE(itemheader.getEND_DATE());

                                          item.setPHONE_NUMBER(itemheader.getPHONE());

                                          item.setSTART_DATE(itemheader.getSTART_DATE());

                                          item.setSUBSTITUTE_NAME(itemheader.getSUBSTITUTE_NAME());

                                          item.setSUBSTITUTE_POSITION(itemheader.getSUBSTITUTE_POSITION());

                                          item.setSUBSTITUTE_USER_NUMBER(itemheader.getSUBSTITUTE_PERNR());

                                          items.add(item);

                                }


I debugged the same even in the object "itemheader" the date field is null. If it was present them I would have converted those to date fields.

How we can solve this issue?

Thanks

Midhun

Accepted Solutions (1)

Accepted Solutions (1)

midhun_vp
Active Contributor
0 Kudos

Found the solution.

It was straight forward.My bad. I haven't tried different ways.

Here you go..

SimpleDateFormat formatDateJava = new SimpleDateFormat("MM/dd/yyyy");

for(Substitutions itemheader : Substitutions.findAll())

                                {

                                          item = new PastSubstitutionsBO();

                         

                                          item.setEND_DATE(formatDateJava.format(itemheader.getSTART_DATE()));

                                        

                                          items.add(item);

                                }

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi midhun,

Check for the date class  http://developer.android.com/reference/java/util/Date.html

first you need to make sure you have to get date from server in string form. If you are getting try to format it using the Date class.

Regards,

Swapnil

midhun_vp
Active Contributor
0 Kudos

Swapnil thanks for our reply.

Even the in the object itemheader when I perform the getstartdate I am not getting the date over there.

I tried debugging it is showing as "DATE" over there instead of the date.

The method getSTART_DATE() comes with the SUP generated code.