I'm trying to launch an intent from an activity class:
Intent i = new Intent(this, (Obscured)MapActivity.class);
i.putExtra("stop", stop);
this.startActivity(i);
And here is my intent receiver in (Obscured)MapActivity:
Intent i = this.getIntent();
if (i != null && i.getSerializableExtra("stop") != null) {
this.displayLocations();
BusStop tempStop = new BusStop();
tempStop = (BusStop) i.getSerializableExtra("stop");
this.goToStop(tempStop);
}
But for some reason it isn't launching. I have another case right above that:
if (i != null && i.getSerializableExtra("loc") != null) {
this.displayLocations();
this.goToLocation((Location) i.getSerializableExtra("loc"));
}
That works just fine, and the intent launcher code is almost completely identical. Any ideas?
EDIT: I'm also using SherlockListActivity, not sure if that changes anything.
<activity
android:name=".(Obscured)MapActivity"
android:configChanges="keyboardHidden|orientation|screenSize|uiMode|screenLayout"
I'm happy to provide more info, this has been bugging me for a few hours now.
ANSWER: Found the issue. For some reason when I add the extras (stop) which is serializable, it breaks. Commenting out the putExtra() and it works. The problem was trying to serialize a GeoPoint.
Found the issue. For some reason when I add the extras (stop) which is serializable, it breaks. Commenting out the setExtra() and it works. Not sure why it won't pass it though, the class extends serializable but everything I try just makes it break again.
Add this in manifest.xml
<activity android:name=".MapActivity"
android:configChanges="orientation|keyboardHidden" />
I'm not sure if that helps, but the JavaDocs of putExtra()
state that you must have a package prefix in the name of the extra:
The name must include a package prefix, for example the app com.android.contacts would use names like "com.android.contacts.ShowAll"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.