Should I use HashMap in Android project?

by Daniel » Sat, 28 Jun 2008 01:25:26 GMT

Sponsored Links
 Hi All,

I did not develop mobile project before, and now I must to develop an
Android project.

example, J2ME doesn't contain HashMap class.

I think it is under the consideration of performing.

I just want to know if I use some classes, which aren't included in
J2ME, can it have great influence on performin.



Should I use HashMap in Android project?

by Romain Guy » Sat, 28 Jun 2008 01:37:52 GMT


HashMap is a very useful class that performs well. Without knowing how
you intend to use this class, we cannot really tell you whether it
will impact performance or not. However, HashMap can be used without
any problem in a large number of situations without impacting

The only situation in which you might want to avoid HashMap is if you
need to store primitive types (int, long, short, etc.) inside, either
as key or value. This will force you to use autoboxing which will
create new objects (Integer, Long, Short, etc.). In such a situation,
you might want to use a SparseArray instead.

Romain Guy


Sponsored Links

Other Threads

1. How to restart service with an intent already created

Hi all,

I am trying restart a service already started and calling to the first
intent created. I am doing it adding this line to the
AndroidManifest.xml in my service declaration:
<service android:enabled="true" android:name=".myservice"
android:process=":remote" android:launchMode="singleTask">

Also, I create the instance of the service like this:

But, when I launch the app twice I have this error:
ERROR/AndroidRuntime(733): java.lang.RuntimeException: Unable to start
service <myservice>d...@43599140 with Intent { action=<myservice>
flags=0x20000000 }: java.lang.IllegalThreadStateException: Thread
already started.

Does anybody how can I do it?



2. How to get the screen dimension?

Hi everybody,

Does anybody know how to get the screen dimension? Is there any
difference between the emulator and the real mobile on the screen
dimension? Thanks in advance.


3. Begginer Questions

4. Decode subset of image

5. Selecting contact causes force close

6. Changing the application icon dynamically

7. TimePickerDialog