android - Intent send is not intent received -


so trying launch new activity after item in list selected.... pretty basic based on i've read. trying send value in extras. can select item in list, , new activity starts, extras set, value in extras empty. i've noticed id of intent on new activity doesn't match 1 1st activity. don't know if supposed or not.

from activity 1:

public void onitemclick(adapterview<?> parent, view view,               int position, long id) {                   intent displayintent = new intent(getapplicationcontext(), displayactivity.class);               int index  = _names.indexof(((textview) view).gettext());               displayintent.putextra("id_tag", ids.get(index));               startactivity(displayintent);           } 

in activity2 (displayactivity)

protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         bundle extras = getintent().getextras();          _hiveindex = extras.getlong("id_tag"); } 

any ideas why wouldn't getting value? mmap under extras set hash map before in 1st intent, null in activity2.

displayintent.putextra("id_tag", ids.get(index)) of activity1 not using bundle object,to put bundle object need use putextras(bundle bundle) method instead of it.since trying bundle object in actvitiy2. passing other bundle object in activity1 putextra method,but trying bundle object in activity2 reason getting nothing. displayintent.putextra("id_tag", ids.get(index));replace displayintent.putextras(your bundle object);

or can use getintextra(string name, int defaultvalue) method.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -