android - myIntent.getStringExtra returns null? -
When I try to send the string with intentions while switching activities, I am having a strange problem.
Here I will do the class 1:
myIntent = new intent (SearchText.this, Search.class); MyIntent.putExtra ("search", spinnerselected); MyIntent.putExtra ("SearchText", input); StartActivity (myIntent); class 2:
intends to myIntent = getIntent (); SearchText = myIntent.getStringExtra ("SearchText"); Spinnerselectednumber = Integer.parseInt (myIntent.getStringExtra ("searchx")); And by using debugger in second class, it is clear that there is a value in it.
However the line myIntent.getStringExtra ("searchx") returns null . Why is that so?
what spinner selected is a string?
Since: API Level 1
> Description: get receive. Parameter: Name name of the desired item Returns: The value of an item previously added to putExtra () or tap if no string value was found.
There are several ways to retrieve "Extras" - whatever spinner was selected , trying to recover it using the proper method Please. For example, if it was an int: public int getIntExtra (name of string, default default)
Comments
Post a Comment