Android Java - Joda Date is slow in Eclipse/Emulator -
Asked Answered
P

4

3

I am trying to find a set of date functions. Looks like the Joda

http://www.joda.org/joda-time/

Does everything I need, but when I call a simple

DateTime dt = new DateTime();

it hangs the Eclipse or Emulator for about 15 seconds.

I must be doing something wrong as I haven't found anyone else complaining about it being slow.

Short of the Joda jar anyone had a datediff() code sample?

Pause answered 28/12, 2010 at 0:26 Comment(0)
G
2

I can confirm this in version 1, 1.5 and 1.62 ... I got bored after that and instead used Date4J which seems to be working perfectly and meets my needs!

http://www.date4j.net/

Gpo answered 10/3, 2011 at 1:20 Comment(1)
very very cool! I wished you had got bored a while ago and found this!Pause
D
0

Is there something wrong with just using the java.util.Date()?

Dougdougal answered 28/12, 2010 at 0:33 Comment(2)
Yes, quite a lot; that's why people use JodaTime.Aleph
I guess I'm just blissfully ignorant then... Sigh.Dougdougal
W
0

You can use the Traceview feature, available from the DDMS perspective, to see where the time is going. When you do this, you'll quickly see most of it is initializing the timezone database.

There's more information about some possible workarounds at this other question.

For my application, I knew I would only ever need a few timezones. So, I blanked out the Olson Timezone Database files in the Jodatime source for all the timezones I wasn't using. Then I rebuilt Jodatime.

Woodall answered 13/5, 2011 at 5:2 Comment(0)
C
-1

Make sure you are using v1.6.2. There was an Android issue in v1.6 and v1.6.1.

Carbonaceous answered 15/1, 2011 at 8:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.