First screen user is ask to select different buttons that are categories then after the categories are selected display the locations in a map.
For example user selects to search for restaurants and bars then click search. Then the next screen will show icons with the locations in the map.
Im confused on how to pass the data from my mainActivity to the MapActivity.
I try to do a loop for each button: but it displays all the buttons I only want to display the selected ones.
—————-Activityone—————-
if (toggleButton5.isChecked()) {
double point3=37326489;
double point4=-121772461;
Bundle b = new Bundle(); // create a bundle to pass to map activity
b.putDouble("point3",point3); // bundle the geo points for the map activity and convert to 1e6
b.putDouble("point4",point4);
Intent myIntent = new Intent(view.getContext(), Map.class); // create the intent to launch the map
myIntent.putExtras(b); // attach bundle to map activity
startActivityForResult(myIntent, 0); // start map activity
//map things!
}
—————-MapAcivity—————-
Bundle b = this.getIntent().getExtras();
Drawable drawable1 = this.getResources().getDrawable(R.drawable.button_food_on);
OverlayMap itemizedoverlay2 = new OverlayMap(drawable1, this);
GeoPoint point2 = new GeoPoint((int)(b.getDouble("point3")),(int) (b.getDouble("point4")));
OverlayItem overlayitem1 = new OverlayItem(point2, "", "");
itemizedoverlay2.addOverlay(overlayitem1);
mapOverlays.add(itemizedoverlay2);
Edit:
first here is an image of the first screen:

You’re trying to do a lot of things here. Parsing xml in android is not trivial. Filtering a list of displayable icons in android is not trivial. When asked individually, answers to these problems are easy to find on this website.
I’ll help you with one of the trivial problems to get you started on your way, though.
The reason you’re not getting the variables that you want to filter to your MapActivity is because you aren’t sending them.
Before you start your intent (and after you declare it) put the variables you want to filter in an Extra, possibly as an array of strings.
Then in your MapActivity you can extract that data that you sent to it from the OnCreate or OnResume function (though really you can call it anywhere inside the activity).
filterYoujustSentinMapActivityshould now have{"restaurants", "bars"}as its data.If you didn’t attach anything to that named extra,
filterYouJustSentwill be null.