android - Bundel.getString("") at onActivityResult() gives null value -
i working on android application in passing data activity 2 activity 1. passing through intent. problem in activity 1, showing value in bundle, when using bundle.getstring("");
, showing me null value. in debugging getting on bundle bundle[{list_size=3}]
. code given below, please me out here.
activity 1:
@override protected void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); if(resultcode==105){ textview txtcounter = (textview) findviewbyid(r.id.txtcounter); // showing value @ mbuddle, @ mbuddle showing null. bundle mbuddle = data.getextras(); string mmessage = mbuddle .getstring("list_size"); txtcounter.settext(mmessage); } }
activity 2:
@override public void onbackpressed() { int request_contacts = 105; intent intent = new intent(); intent.putextra("list_size", flistcontacts.size()); setresult(request_contacts, intent); finish(); }
@override protected void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data) if (requestcode == request_code) { if (resultcode == activity.result_ok) { string contents = intent.getstringextra(intents.scan.result); }} }
===============
intent intent = new intent(getintent().getaction()); intent.addflags(intent.flag_activity_clear_when_task_reset); intent.putextra(key, data); setresult(result_ok, intent); finish();
result_ok can int value
Comments
Post a Comment