i have no idea happening here. have hashmap following keyset of size 4:
steps.keyset() (java.util.hashmap$keyset) [init_fzlist, init_data, install_database, prompt_geraeteid]
init_fzlist, init_data, install_database , prompt_geraeteid values of enum.
also entryset delivers 4 entries.
steps.entryset() (java.util.hashmap$entryset) [init_fzlist=de.ansat.terminal.activity.widgets.pendingcheckbox{b50cb4e0 v.e..... ......i. 24,524-456,666}, init_data=de.ansat.terminal.activity.widgets.pendingcheckbox{b50c8748 v.e..... ......i. 24,350-456,524}, install_database=de.ansat.terminal.activity.widgets.pendingcheckbox{b508e288 v.e..... ......i. 24,68-456,209}, prompt_geraeteid=de.ansat.terminal.activity.widgets.pendingcheckbox{b50c59b0 v.e..... ......i. 24,209-456,350}]
but if this:
steps.get(install_database) null
the map returns null , of cause nullpointerexception if try work resulting object.
this running in android activity. i'm using android 4.2.2 on api level 17
[edit]
private map<installsteps, pendingcheckbox> steps = new hashmap<installsteps, pendingcheckbox>();
is field of activity class.
i have several asynctasks working on map, represents progress of installation process.
pendingcheckbox view extending linearlayout.
[edit2] steps filled in oncreate(..) way:
pendingcheckbox installdb = new pendingcheckbox(installactivity.this); installdb.settext(install_database); installdb.setchecked(false); installdb.setlayoutparams(layoutparams); root.addview(installdb); steps.put(installsteps.install_database, installdb);
has idea might cause behaviour? i'm completly stuck. tip appreciated!
you can use enummap instead of hashmap
.
a specialized map implementation use enum type keys. of keys in enum map must come single enum type specified, explicitly or implicitly, when map created.
as far code concerned , remember:
the
hashcode
of objects in map should not change once added map. implementation ofequals()
,hashcode()
required.check if
put(key,value)
objectkey
beforeget(key)
ing value.
Comments
Post a Comment