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.

Thanks
Daniel

--~--~---------~--~----~------------~-------~--~----~



Should I use HashMap in Android project?

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


 Hi,

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
performance.

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
www.curious-creature.org

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. About removing all android apps

Hi All,

   I've developed a android app for a device.I have built my app along
with other apps of gingerbread in linux.Now what i want to do is, to
keep my app alone and remove all other
apps(calender,messaging.........etc).how to achieve this?

Any suggestions?

Thanks
Bhavani

-- 

2. simultaneous download of files - best way to handle it

Hi All,

I am writing an application targeting API level 9 or higher. So, i
have decided to go with DownloadManager Class that SDK offers.

My question is 2 part -
1. When i am downloading a single file, how do i display the progress
of the download. I see i can get COLUMN_TOTAL_SIZE_BYTES and
COLUMN_BYTES_DOWNLOADED_SO_FAR from the querying the download manager
instance. But i am not sure if i have to put the query in a thread and
implement a loop so that i can poll regularly to update the progress
bar. I guess, i am not sure, how to query regularly - will it go in
the main thread or be implemented as a runnable - the mechanism i am
not clear.

2. If i have to support multiple file downloads, then do i have to
launch each one of them in it's own thread?

Thanks.

-- 

3. Broadcast receiver not working in Activity

4. keyboard, where are you

5. Android and camera

6. Show default view in activitygroup

7. LG Optimus 2X