Android :: Java.util.Calendar - Time Difference
Jul 29, 2009
I want to make calendar view in order to support touch interaction. So I'd like to build new custom calendar view. I tried to make mapping function between view offset and real date value.
Here is my idea:
If I can compute the number of weeks since base date(in my case, 1989-12-31), it is easy to know offset. HEIGHT_FOR_WEEK * NUM_OF_WEEK is very simple computation to know exact offset.
My problem is this:
First I got milliseconds value from base date. And I set the milliseconds to another calendar object. I expected same date from that object. But actually it was different date.
CODE:...............
Here is my CODE:.........................
View 2 Replies
Nov 12, 2010
I'm creating a android.text.format.Time Object from a java.util.Calendar Instance, and I read it out field by field.
View 1 Replies
View Related
Oct 26, 2010
Which one should I use java.util.Date or android.text.format.Time? It seems you can accomplish what one needs to do with either. What I need to do is at times get the current date and time and sometimes set a date and time specified by the user.
View 5 Replies
View Related
Sep 3, 2010
I want to know about the util Class used in Java. I am currently working on one Application in Android where I need to used a class from one file to another different file. I was told to import it like "import com.android.utli.(ClassName)" here the "com.android.util" is a package name.
Can I use thast class in my another file simply by importing the package along with the Class Name?
View 2 Replies
View Related
Jan 15, 2010
Can I rely on Timer and TimerTask to work properly on Android?
I have a background Service with a single Timer, and I schedule (possibly multiple) TimerTask's via Timer.schedule()
At the beginning of each implemented TimerTask.run() method, I check the TimerTask.scheduledExecutionTime() and compare it with the current time. Sometimes things are fine, and the difference is a small number of ms. But sometimes things are nowhere near fine, and the invocation of my TimerTask is *way* late -- like multiple hours late.
Can an Android phone go into some deep sleep mode when it doesn't think anything is going on that would cause a TimerTask to be so late? Can I not reliably use TimerTask for scheduling events, and should I be using some Android-specific means (e.g. the AlarmManager, or a Handler) instead?
I have not found anything that says that java.util.TimerTask shouldn't be sufficient, the Android docs include no kinds of qualifiers, and this post (from Mark Murphy, who's written several good Android books) specifically mentions it as being available:
http://groups.google.com/group/android-developers/browse_thread/threa...
View 5 Replies
View Related
Jan 22, 2010
I want to create a java.util.map in android from a resource. I want to do this because I have a lot of entries to populate into the java.util.map and I want to store the values in the res folder of the project in xml format.
Is there an effecient way to do this in android? My map will have around 2500 entries so I want to do this as effeciently as possible and I don't want to hard code them...
View 1 Replies
View Related
Apr 14, 2010
I want to use ConcurrentLinkedQueue in an android application, have written the code, but now I'm getting an error when the project builds:
Conversion to Dalvik format failed with error 2
I'm using Eclipse with the lastest version of the ADT plugin.
View 1 Replies
View Related
Apr 19, 2010
That is the only thing I can think of. When I generate a random number (for the radius of a ball), after a while, the radius goes to one number and sticks that way. I've even tried setting the random number value to 0 before getting the random number, and java.util.Random must be at fault, it still gives the same random number. Here is an apk if you would like to try it yourself: http://74.118.194.50:84/Balls.apk
Here is a snippet of the code (I would rather not release the full source): <code> Random randomizer = new Random(System.currentTimeMillis()); int hw; hw = randomizer.nextInt(95-15+1)+15; </code>
View 4 Replies
View Related
Mar 15, 2010
In a Android application I want to use Scanner class to read a list of floats from a text file (it's a list of vertex coordinates for OpenGL). Exact code is:
CODE:.................
It seems however that this is incredibly slow (it took 30 minutes to read 10,000 floats!) - as tested on the 2.1 emulator. What's going on?
I don't remember Scanner to be that slow when I used it on the PC (truth be told I never read more than 100 values before). Or is it something else, like reading from an asset input stream?
View 4 Replies
View Related
Sep 25, 2009
My app needs to save its state before being killed, and since that state is really small (one Long), I've decided to use java.util.Preferences. I use it like the way I would be using in any Java application (and never had problems), though I am not sure this is the correct way here on Android platform: private static final Preferences prefs = Preferences.userNodeForPackage (WordChoice.class);
I update preferences in onPause() method, to ensure that data is always persisted no matter how my app ends: Here is that fragment of code: protected void onPause() { super.onPause(); prefs.putLong("currIndex", somePositiveValue); }
View 2 Replies
View Related
Apr 7, 2010
I'm trying to launch a lot of remote connection retrieve picture on a server. To do this, I use AsyncTask.
This pics are displayed in a listview using adapter.
If I implement this in my adapter, images are retrieved but the display is bad (problem with index or something like that).
If I try to retrieve image when I build my object list (contained in my listview), I get the exception 04-07 13:35:57.744: ERROR/AndroidRuntime(4132):
CODE:.................
What is this exception ? Why I can launch multiple asynctask in my listview (giving to me a bad result) and not in a simple object without having this issue ?
View 6 Replies
View Related
May 19, 2009
I need a map from int to certain objects. I wanted to use the HashMap, but in the documentation of SparseArray it says that SparseArray is intented to be *more efficient*: http://developer.android.com/reference/android/util/SparseArray.html
However i think the documentation is not entirely correct and needs more info: When reviewing the sourcecode of SparseArray and comparing it with the HashMap i come to the following conclusion
Source code of Sparse Array: [url]
For SpareArray: Time complexity for reads and writes on a map of size N is log2(N) + 1,
However the time complexity for a HashMap of size N is C*N (where C is a constant) (according to the javadoc [url]
So maybe SparseArray is more efficient with respect to space complexity it is not for time complexity. So for programs that need high performance a HashMap may be better.
At least thats what i think. Am i right? Am i wrong? I need a very fast implementation for my game.
View 4 Replies
View Related
Mar 18, 2010
I've done changes in an Android native library and installed a new system.img file but am now getting an unrelated Error on startup. I can get past it by swallowing the error but I wanted to know if anyone can explain what the issue is.
The Android implementation of Logger.java claims that it is Forcing the LogManager to be initialized since its class init code performs necessary one-time setup. But this forced initialization results in a NoClassDefFoundError. I'm thinking that it has something to do with the class not having been preloaded by Zygote yet but am not that familiar with the whole class loaders and VM business.
code:....................
View 5 Replies
View Related
Oct 27, 2009
I am using the Eclipse plugin and I have the above error. I know why it is occurring, it is because I want to override a class file in one of my imported jar files. I am including a new Util class before the jar file in question. I have tried it both as a simple .class file in my package hierarchy and I have tried putting it into another jar file and including it before the one to be overridden.
I would like it to behave like the Java classpath and use the first one it comes to when running through all the classes. I don't mind if dex wants to give me a warning that it is not using the second Util.class file but it should let me build my application. To build my app, I have to create a special jar file without the old Util.class in it. This is annoying as I would like to use the bog standard version so that others can use it with ease too.
View 3 Replies
View Related
Apr 2, 2010
In an Android app I have a utility class that I use to parse strings for 2 regEx's. I compile the 2 patterns in a static initializer so they only get compiled once, then activities can use the parsing methods statically.
This works fine except that the first time the class is accessed and loaded, and the static initializer compiles the pattern, the UI hangs for close to a MINUTE while it compiles the pattern! After the first time, it flies on all subsequent calls to parseString().
My regEx that I am using is rather large - 847 characters, but in a normal java webapp this is lightning fast. I am testing this so far only in the emulator with a 1.5 AVD.
Could this just be an emulator issue or is there some other reason that this pattern is taking so long to compile?
CODE:.......................
View 3 Replies
View Related
Sep 24, 2010
I'm usign starMethodTrace() and stopmethodTtrace() to get trace data to use on traceview. Everything seems to work fine. I test my app for 50 (real world) seconds having two important events after 15 and 45 seconds from start tracing. However, when analyzing the traceview's timeline I found the total tracetime is only 1.068,964 (msec). My two events are displayed as they were occurred at time 257,743 msec and 642,654 msec. This is just about 1 second of total execution time. Why there is this huge difference between real world time and trace view time? May be because I have a lot of idle time? Is there a way to relate the times displayed in the time line with real world time?
View 2 Replies
View Related
Oct 19, 2012
yesterday i see for the first time the calendar app in the play store, this make me foolish, because it is not the same app pre-installed in every ROM....
View 7 Replies
View Related
Dec 4, 2009
ok so call me the new guy but what is the difference between google calendar and google corporate calendar? should i be using corporate? does it have mre options? does it sync with something?
View 3 Replies
View Related
Aug 10, 2010
What is the difference among bool, boolean and Boolean in Java/android.
View 2 Replies
View Related
Apr 1, 2010
I'm working on a program whose job is to parse a schema from a course at university (html) and synchronize it with a calendar in Google Calendar. A must-have requirements from the author is that the user must enter their user information (x...@gmail.com) then connect via the Calendar API to calendar services. ** The smartphone calendar via Intent is not okay to use **
The main problem is that there is no GData (Dalvik Java) for Android. But I checked on GitHub and found that there seems to be something going on com.google.wireless.gdata: http://android.git.kernel.org/?p=platform/external/gdata.git,a=summary Searched around and found some packets like simply-android-GData and GData on code.google.com, but none of them help with the structure of calendrar, and they can login to retrieve data rss, json, atom.
So my question is then whether someone has a solution that works quite well as a possible. next update of the SDK will provide, a full GData API?
Is it possible to compile a custom SDK from git and get with the functionality of git://android.git.kernel.org/platform/external/gdata.git?
Minimum functionality: View Calendars View Events Add Events Delete Events
View 4 Replies
View Related
Jan 2, 2010
How to get the SDK Version at run time of java program.
View 2 Replies
View Related
Apr 10, 2010
I am developing a simple app which does a little bit of image-processing. It's divided in two activities; the main one with some display elements and the second one which is used to capture images off the phone's camera.
To discribe my problem: I start the app, capture an image (by starting a new Intent with the subactivity) and all data is displayed correctly. If I capture another image after this, I run in an java.lang.OutOfMemoryError - bitmap size exceeds VM budget
I dont store the captured bitmap, in the second activity I just extract some data from it and pass it to the main-activity; finishing (finish()) the sub-activity afterwards.
View 1 Replies
View Related
May 11, 2009
Is it possible to get the calendar's entries from the phone offline? It seem the only way is to use gdata-java-client.
View 4 Replies
View Related
Jul 28, 2010
I want to access the build type [release/debug] in java code and xml file to enable or disable the particular feature at the run time.
Please let me know if we have any environment variable defined for it which can be accessed in java code and in xml file also.
View 3 Replies
View Related
Oct 26, 2010
My Google Calendar on my Android phone is off by one hour. Although it displays correctly on the website, on my Android phone some of the times are off by 1 hour. When I click into the event, it says (America/Cancun) which I assume means for some reason its displaying Cancun time zone.
View 3 Replies
View Related
Aug 17, 2010
I have a facebook event in my device's calendar that is displaying the correct time on the main calendar, but showing the incorrect event time in two different calendar widgets I've tried, as well as the event list in the Facebook app.
To make matters more complicated, the facebook app is displaying a different incorrect time than the widgets.
I've removed the facebook event from my calendar, reinstalled the widgets, done a battery pull, resynced, and the problem persists.
I think the host changed the time of the event after I first synced it to my phone, but I'm not sure.
View 2 Replies
View Related
Aug 10, 2010
Is there an app that anyone knows about to make the scroll go continuously around. For example when you get to 59 minutes the next number is 0 instead of stopping and having to back track all the way through all the numbers.
View 2 Replies
View Related
May 6, 2010
I hate calendar reminders, almost never use them, and I have my Google calendars set up to default to no reminder when I enter a new event. But on the Incredible, I can't figure out how to do that. When I enter a new event there is an option to set the reminder as "none" for that event. But under calendar settings, "none" is not listed as one of the options for the default reminder time - there's nothing above 5 minutes on the drop-down list. Anyone know if there's any way to do this? I just can't believe it's not an option and that I have to manually delete the reminder for every single event I enter into the calendar...
View 9 Replies
View Related
Mar 25, 2010
So I've been counting on the alerts from the calendar to warn me prior to meetings (not synced to Outlook- system won't allow). I haven't changed anything on the phone and today it didn't alert me for two different appointments? Has this happened to you? Also, is there any way to set the time of alert different from the standard 5 minutes before appointment?
View 4 Replies
View Related
Nov 12, 2010
I want to remove the existing calendar application icon and replace it with a date/time widget over it. The widget now when pressed does nothing but only shows current date and day of week. Can this be done? I have tried other programs but they only seem to allow me change the name of the icon. I tried using any cut and also Launcher.
View 2 Replies
View Related