I am making a map application. I want to call the map activity from another activity and pass string parameters into the map activity. I was going to use bundles. Ive tried some code to get them working and am completely lost.
Does anybody have some sample code on how to use bundles?
Here is what i tried:
List Activity:
Using java Syntax Highlighting
- String s = "Hello world";
- Bundle extras = new Bundle();
- extras.putString("titles", s);
- Intent i = new Intent(this, ShowMap.class);
- i.putExtras(extras);
- startSubActivity(i, 0);
Parsed in 0.031 seconds, using GeSHi 1.0.8.4
Map Activity:
Using java Syntax Highlighting
- public void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- setContentView(R.layout.showmap_map);
- Bundle example = icicle.getBundle("extras");
Parsed in 0.031 seconds, using GeSHi 1.0.8.4
I guess my simplified question would be: What code do i need in my map activity to unpack the extras bundle and access the "hello world" string inside it?





