title: add button on map fragment to perform action on the map
body: <p>I'm working on a simple map app, i used the <code>navigationDrawer</code> to put my map in the first option of the <code>drawer</code>.. now the problem is when i put any button in the same <code>fragment</code> of the map or the same layout it doesn't perform what i want!
  for example : i need to zoom on my location when i click the <code>button</code>.
  i tried some solutions i found on the site but there was no luck.. </p>
  
  <p><a href="https://i.stack.imgur.com/bO5ue.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bO5ue.png" alt="image"></a> </p>
  
  <p>xml code : </p>
  
  <pre><code>&lt;android.support.constraint.ConstraintLayout 
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"&gt;
  
  
     &lt;fragment android:layout_height="match_parent"   
    android:layout_width="405dp" android:id="@+id/mapfragment"
  
      class="com.google.android.gms.maps.MapFragment"
  
  
      android:layout_marginEnd="8dp"
      app:layout_constraintBottom_toBottomOf="parent"
      app:layout_constraintEnd_toEndOf="parent"
      app:layout_constraintTop_toTopOf="parent"
      android:layout_marginRight="8dp"
  
  /&gt;
  
  
  &lt;RelativeLayout android:layout_width="wrap_content" 
  android:layout_height="wrap_content"&gt;
      &lt;Button
          android:id="@+id/bt1"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_marginBottom="46dp"
          android:text="Button"
          app:layout_constraintBottom_toBottomOf="parent"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintStart_toStartOf="parent"
          android:onClick="onClick"
          /&gt;
  &lt;/RelativeLayout&gt;
  
  
  
  
  &lt;/android.support.constraint.ConstraintLayout&gt;
  </code></pre>
  
  <p>java code : </p>
  
  <pre><code> public class maptest extends Fragment implements OnMapReadyCallback,View.OnClickListener {
  GoogleMap mp;
  
  @Nullable
  View v1;
  
  public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
  
      Button bt2=(Button)v1.findViewById(R.id.bt1);
      bt2.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              Toast.makeText(getActivity(), "ggg", Toast.LENGTH_SHORT).show();
          }
      });
  
  
      return inflater.inflate(R.layout.newmapfragment, container,false);
  
  }
  
  
  
  @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR1)
  @Override
  public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
      super.onViewCreated(view, savedInstanceState);
  
      MapFragment fragment= (MapFragment) getChildFragmentManager().findFragmentById(R.id.mapfragment);
      fragment.getMapAsync(this);
  
  }
  
  @Override
  
  public void onMapReady(GoogleMap mp) {
      // Add a marker in Sydney, Australia,
      // and move the map's camera to the same location.
      LatLng sydney = new LatLng(31.163937, 35.710373);
      mp.addMarker(new MarkerOptions().position(sydney)
              .title("Marker in Sydney"));
      mp.moveCamera(CameraUpdateFactory.newLatLng(sydney));
  
     mp.addMarker(new MarkerOptions().position(new 
     LatLng(31.163937,35.710373)).title("mymap")).showInfoWindow();
     mp.animateCamera(CameraUpdateFactory.newLatLngZoom(new 
     LatLng(31.163937,35.710373),16));
     }
  
  
  
     @Override
     public void onClick(View view) {
      Button b = (Button) view.findViewById(R.id.bt1);
      b.setOnClickListener(this);
      LatLng sydney = new LatLng(31.163937, 35.710373);
      mp.addMarker(new MarkerOptions().position(sydney)
              .title("Marker in Sydney"));
      mp.moveCamera(CameraUpdateFactory.newLatLng(sydney));
  
      mp.addMarker(new MarkerOptions().position(new 
      LatLng(31.163937,35.710373)).title("mymap")).showInfoWindow();
      mp.animateCamera(CameraUpdateFactory.newLatLngZoom(new 
      LatLng(31.163937,35.710373),16));
       }
  
  
      }
  </code></pre>
  
  <p>any help will be appreciated.. </p>