android - Send a putExtra to an activity -


i have code:

rechercher.java:

public void doonresult(string json){     if ( json.equals("aucune propostion pour le mois")||json.equals("aucune propostion pour cette date")) {         toast.maketext(rechercher.this, "aucune proposition actuellement.", toast.length_long).show();         finish();     } else {         intent iafficher = new intent(this, afficher.class);         extras.putstring("json", json);         extras.putint("nbplaces", mcounter);         iafficher.putextras(extras);         this.startactivityforresult(iafficher, 10);     }                    } 

afficher.java:

integer places = extras.getint("nbplaces");  protected void oncreate(bundle savedinstancestate){     super.oncreate(savedinstancestate);     setcontentview(r.layout.afficher);     listview lvtrajets = (listview)findviewbyid(r.id.lvtrajets);     bundle bundle = getintent().getextras();      .......      proposition.put("date",propid);     proposition.put("trajet", proplieu+" de "+propville+" --> "+propgare+" places : "+places); 

the places variable equal 0.

i don't know why can't right value.

you need value bundle in afficher.java file in oncreate method below:

protected void oncreate(bundle savedinstancestate){     super.oncreate(savedinstancestate);     setcontentview(r.layout.afficher);     listview lvtrajets = (listview)findviewbyid(r.id.lvtrajets);     bundle bundle = getintent().getextras();      integer places = bundle.getint("nbplaces"); //get value here     string jsonval=bundle.getstring("json");  

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -