1. As written in http://developer.android.com/reference/android/app/DatePickerDialog.OnDateSetListener.html: monthOfYear The month that was set (0-11) for compatibility with Calendar.
2. Did you try to print startdate and enddate to be sure of their values ? Your code is not complete, where did you declare mYear, mMonth and mDay ? 3. I'm not sure but I suppose that getEntries gives the result from the last application on top, like getExtras. I have one question for you : what packages are you using ? I googled for days looking how to get datas from gmail without success. Thanks, ik. On 19 fév, 12:22, gganesh <[email protected]> wrote: > Hi group, > I trying to use Datepicker widget to select the date and pass to > google gdata api to fetch calender events > > private DatePickerDialog.OnDateSetListener mDateSetListener = > new DatePickerDialog.OnDateSetListener() { > > public void onDateSet(DatePicker view, int year, > int monthOfYear, int dayOfMonth) > { > > mYear = year; > mMonth = monthOfYear+1; // why is that step up is > needed > mDay = dayOfMonth; > updateDisplay(); > } > }; > > private void updateDisplay() { > > StringBuilder status= new StringBuilder(50); > String y1=String.valueOf(mYear); > String m1=String.valueOf(mMonth); > if(m1.length()==1) > { > m1="0"+m1; > } > String d1=String.valueOf(mDay); > if(d1.length()==1) > { > d1="0"+d1; > } > > String startdate=y1+"-"+m1+"-"+d1+"T"+"00:00:00"; > //example out put for startdate:2009-02-12T00:00:00 > String enddate=y1+"-"+m1+"-"+d1+"T"+"23:59:59"; > > try{ > > myQuery.setMinimumStartTime(DateTime.parseDateTime(startdate)); > myQuery.setMaximumStartTime(DateTime.parseDateTime(enddate));; > Feed resultFeed = myService.query(myQuery, Feed.class); > for (int i = 0; i < resultFeed.getEntries().size(); i++) { > Entry entry = resultFeed.getEntries().get(i); > status.append("\t" + > entry.getTitle().getPlainText()); > > } > }catch(Exception e){System.out.println(e);} > > mDateDisplay.setText(status); > > } > > I will be glad if someone clarifies few points > > 1. Why is that this step up is needed - > mMonth = monthOfYear+1; > 2. DateTime.parseDateTime(String args) takes date format as > 2009-02-12T00:00:00 and is there any other simple approach to convert > int values from Datepicker to required format,the one shown above > doesn't work .At present i hard-code values to make it work ,like > > myQuery.setMinimumStartTime(DateTime.parseDateTime("2010-02-12T00:00:00")); > > myQuery.setMaximumStartTime(DateTime.parseDateTime("2010-03-12T23:59:59")); > > 3. The code works fine(when i hard code the as shown above) for the > very time of execution .when i clicked back button and again tried to > run the app ,resultFeed throws Null pointer exception. > > I could appreciate your valuable suggestion to correct my mistakes. > > Thanks > ganesh -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en

