I decided to implement the "Location" button with all the states, like on Google maps.
More details:
- Inactive - When the user scamps on the map.
- Active - When the user has determined his location on the map, and the camera follows its movement.
Now to the code:
<android.support.design.widget.FloatingActionButton android:layout_margin="16dp" android:layout_width="wrap_content" android:layout_height="wrap_content" app:elevation="1dp" android:src="@drawable/ic_my_location_black_24dp" android:tint="@android:color/background_dark" //серый цвет т.е. неактивная изначально app:backgroundTint="@android:color/white" android:layout_gravity="bottom|end"/> Location Button:
FAB.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { cameraFromPosition(); followUser = true; FAB.setColorFilter(ContextCompat.getColor(getApplicationContext(),R.color.primary)); // синий цвет т.е. активная } }); Location tracking:
@Override public void onLocationChanged(Location location) { if (followUser) { // начинаем слежку т.к. нажата кнопка "определения местоположения" и цвет ей синий cameraFromPosition(); } } What is the best way to implement the " Catch " method , when the user again began to run hither and so on the map, and thereby make the button inactive, ie gray?

