Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private String drawRuning = off; -------------- that
- location_switch = (MaterialAnimatedSwitch) findViewById(R.id.location_switch);
- location_switch.setOnCheckedChangeListener(new MaterialAnimatedSwitch.OnCheckedChangeListener() {
- @Override
- public void onCheckedChanged(boolean isOnline) {
- if (isOnline){
- FirebaseDatabase.getInstance().goOnline();
- StartLocationUpdate();
- Displaylocation();
- Snackbar.make(mapFragment.getView(),"You Are Online",Snackbar.LENGTH_SHORT).show();
- }else {
- FirebaseDatabase.getInstance().goOffline();
- StoplocationUpdates();
- mCurrent.remove();
- mMap.clear();
- if (drawRuning.equals("on")){ ---------------- that
- drawRuning = "off"; ------------------------- that
- handler.removeCallbacks(drawPathRunnable); --- -- because that
- Snackbar.make(mapFragment.getView(),"You Are Offline",Snackbar.LENGTH_SHORT).show();
- }else {
- Snackbar.make(mapFragment.getView(),"You Are Offline",Snackbar.LENGTH_SHORT).show();
- }
- }
- }
- });
- and in
- private void getDirection() {
- if (drawRuning.equals("off")) { ------------ that
- drawRuning = "on"; ------------ that
Add Comment
Please, Sign In to add comment