Thanks Brion,

After looking into the code found that problem is here in this snippet of
code:

    /**
     * If the given intent specifies a time (in milliseconds since the
epoch),
     * then that time is returned. Otherwise, the current time is returned.
     */
    public static final long timeFromIntentInMillis(Intent intent) {
        // If the time was specified, then use that.  Otherwise, use the
current time.
        long millis = intent.getLongExtra(EVENT_BEGIN_TIME, -1);
        if (millis == -1) {
            millis = System.currentTimeMillis();
        }
        return millis;
    }

The  "intent.getLongExtra" is somtimes retuning zero and this should return
-1 if  not able to get correct value of milli second since  epoch.
One fix to this can be call  System.currentTimeMillis() if it return zero
also (as it calls for -1).

I am still looking root cause of this (why it returns zero somtimes ).

Thanks
Sandy






On Wed, May 5, 2010 at 1:31 AM, Brion Emde <[email protected]> wrote:

> You don't show your code, so it's hard to see what the problem is. I'd
> guess that you are creating an uninitialized Calendar of some sort, so
> the date inside of it is zero, corresponding to the date that you
> report.
>
> A way to get a calendar of the current is like this:
>
> private Calendar mCalendar = GregorianCalendar.getInstance();
>
>
>
> On May 4, 6:35 am, sandeep gupta <[email protected]> wrote:
> > In Android 2.1, when I am opening Calendar application, going to Agenda
> view
> > and from their if I go to Day  schedule, that date is shown as "Thursday
> > 01-Jan-1970" in title bar.  It is not picking system date.
> >
> > This is same case for week and Month view. In week schedule it is showing
> > "December 1969 - January 1970" and for Month it display "January 1970" at
> > Calendar title bar. This is happening when I go to day/month/week
> schedule
> > from Agenda page.
> >
> > I am not seeing any error in logcat message when wrong date is displayed.
> > Here is the logcat message:
> >
> > # I/ActivityManager(   54): Starting activity: Intent {
> > act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]
> > flg=0x10200000 cmp=com.android.calendar/.LaunchActivity }
> > D/AccountManagerService(   54): bind attempt failed for Session:
> > expectLaunch false, connected false, stats (0/0/0), lifetime 0.001,
> > getAccountsByTypeAndFeatures, legacy_hosted_or_google
> > I/ActivityManager(   54): Starting activity: Intent { flg=0x20020000
> > cmp=com.android.calendar/.AgendaActivity }
> > I/ActivityManager(   54): Displayed activity
> > com.android.calendar/.AgendaActivity: 549 ms (total 678 ms)
> > D/dalvikvm(   99): GC freed 617 objects / 32344 bytes in 169ms
> > W/KeyCharacterMap(  137): No keyboard for id 0
> > W/KeyCharacterMap(  137): Using default keymap:
> > /system/usr/keychars/qwerty.kcm.bin
> > I/ActivityManager(   54): Starting activity: Intent {
> > act=android.intent.action.VIEW flg=0x20020000
> > cmp=com.android.calendar/.DayActivity (has extras) }
> > D/PhoneWindow(  137): couldn't save which view has focus because the
> focused
> > view com.android.calendar.agendalistv...@43c591f0 has no id.
> > D/dalvikvm(  137): GC freed 1665 objects / 131536 bytes in 84ms
> > I/ActivityManager(   54): Displayed activity
> > com.android.calendar/.DayActivity: 601 ms (total 601 ms)
> > #
> >
> > Can any body give some pointer to solve this.
> >
> > Thanks
> > Sandy
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]<android-developers%[email protected]>
> > For more options, visit this group athttp://
> groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to