I am passing through the intent to get delivery of the error, null pointer, I am the Getmap method to pass the value, the code is as follows
public void Getmap (view view) { Intent i = new Intent (this, breweryyourtopbeers.class); LOG.D ("Map", E.beerbreweryid); I.putextra ("Breweryid", E.beerbreweryid); I.setclass (this, brewerymap.class); StartActivity (i); }
I can see from my log that E.beerbreweryid does have a value before the value is passed, and I get the change in the code below
public class Brewerymap extends Actionbarmenu { beerdata e; String Beerid; GoogleMap map; get beer details from bundles protected void OnCreate (bundle savedinstancestate) { super.oncreate ( Savedinstancestate); Setcontentview (R.LAYOUT.ACTIVITY_BREWERYMAP); Get Brewery data //get beer data Intent Intent = Getintent (); Bundle extras = Intent.getextras (); String Breweryid = extras.getstring ("Brewreyid"); Map = ((mapfragment) Getfragmentmanager (). Findfragmentbyid (R.id.map)). Getmap (); String url = "http://api.brewerydb.com/v2/brewery/" + Breweryid + "? key=mykey&format=json&withlocations=y"; LOG.D ("map", url); New Myasynctask (This,map). Execute (URL);}}
Every time I get the value is NULL, do not know what the reason.
Processing methods
One line has been written wrong.
Put
String Breweryid = extras.getstring ("Brewreyid");
Into
String Breweryid = extras.getstring ("Breweryid");
Original address: http://www.itmmd.com/201411/134.html
This article by Meng Meng's IT person to organize the release, reprint must indicate the source.
Android obtains null via intent value