title: Sending search parameter from activity to google maps api (Android studio)
body: <p>First of, just gonna say that i'm not the best at explaining (nor at programming), so bear with me.</p>
  
  <p><strong>The layout:</strong></p>
  
  <p>I have two activities.
  First one is the main activity where a checkbox and a button are located.
  the second activity is the google maps api.</p>
  
  <p><strong>The progress:</strong></p>
  
  <p>When I click the button I enter the google maps activity (using intent) and have a fixed location.</p>
  
  <p><strong>The problem:</strong></p>
  
  <p>I want to send a location search to google maps IF the checkbox is checked when pressing the button (<em>example: if the checkbox says bowling, the search would be for bowling</em>), but I don't know how nor where to write this code.</p>
  
  <p>Any links/tips/answers are appreciated :)</p>
  
  <p><strong>MainActivity</strong></p>
  
  <pre><code>private static Button button_Ok;
  private static CheckBox bowling;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      onClickButtonListener();
  }
  
  public void onClickButtonListener() {
      button_Ok = (Button)findViewById(R.id.button);
      bowling = (CheckBox)findViewById(R.id.checkBox);
      button_Ok.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              Intent intent = new Intent("com.google.android.gms.maps.SupportMapFragment");
              startActivity(intent);
          }
      });
  }
  </code></pre>
  
  <p><strong>MapsActivity</strong></p>
  
  <pre><code>private void setUpMap() {
      mMap.addMarker(new MarkerOptions().position(new LatLng(0, 0)).title("Marker"));
      mMap.setMyLocationEnabled(true);
  
      // Get LocationManager object from System Service LOCATION_SERVICE
      LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
  
      // Create a criteria object to retrieve provider
      Criteria criteria = new Criteria();
  
      // Get the name of the best provider
      String provider = locationManager.getBestProvider(criteria, true);
  
      // Get Current Location
      Location myLocation = locationManager.getLastKnownLocation(provider);
  
      // set map type
      mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
  
      // Get latitude of the current location
      double latitude = *fixed*; //myLocation.getLatitude();
  
      // Get longitude of the current location
      double longitude = *fixed*; //myLocation.getLongitude();
  
      // Create a LatLng object for the current location
      LatLng latLng = new LatLng(latitude, longitude);
  
      // Show the current location in Google Map
      mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
  
      // Zoom in the Google Map
      mMap.animateCamera(CameraUpdateFactory.zoomTo(14));
      mMap.addMarker(new MarkerOptions().position(new LatLng(latitude, longitude)).title("You are here!").snippet("Consider yourself located"));
  
      LatLng myCoordinates = new LatLng(latitude, longitude);
      CameraUpdate yourLocation = CameraUpdateFactory.newLatLngZoom(myCoordinates, 12);
      mMap.animateCamera(yourLocation);
  
      CameraPosition cameraPosition = new CameraPosition.Builder()
              .target(myCoordinates)      // Sets the center of the map to LatLng (refer to previous snippet)
              .zoom(13)                   // Sets the zoom
              .bearing(90)                // Sets the orientation of the camera to east
              .tilt(0)                   // Sets the tilt of the camera to 30 degrees
              .build();                   // Creates a CameraPosition from the builder
      mMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
  
      // ... get a map.
      Circle circle = mMap.addCircle(new CircleOptions()
              .center(new LatLng(*fixed*, *fixed*))
              .radius(100)
              .strokeColor(Color.RED)
              .fillColor(Color.TRANSPARENT));
  
  
      mMap.getUiSettings().setZoomControlsEnabled(true);
  }
  
  }
  </code></pre>
  
  <p>I've set fixed LatLng because the get location function doesn't seem to work on the emulator.</p>