-2

if user open the map then show static location and after 10 second marker move on current location. Please help me as soon as possible

Reyaj
  • 135
  • 1
  • 7

1 Answers1

-1

You can Start timer in thread , After 10 seconds complete call method to show current location,

Code for Thread:-

public class CounterClass extends CountDownTimer {

    public CounterClass(long millisInFuture, long countDownInterval) {
        super(millisInFuture, countDownInterval);
    }

    @Override
    public void onFinish() {
        // textViewTime.setText("Completed.");


        }

    }

For Location:-

LatLng HAMBURG = new LatLng(Double.valueOf(val),Double.valueOf(longValue));
                    FragmentManager myFM = getActivity().getSupportFragmentManager();

                     myMAPF = (SupportMapFragment) myFM
                                    .findFragmentById(R.id.mapDetailview);
                    //System.out.println("SupportMapFragment is " + myMAPF);
                    //System.out.println("Map is " + myMAPF);
                    map = myMAPF.getMap();

                   LatLng KIEL = new LatLng(Double.valueOf(val),Double.valueOf(longValue));

                    Marker hamburg = map.addMarker(new MarkerOptions().position(
                            HAMBURG).title(""));

                    Marker kiel = map.addMarker(new MarkerOptions()
                            .position(KIEL)
                            .title("Hello")
                            .snippet("Kiel is cool")
                            ); 

                    map.moveCamera(CameraUpdateFactory.newLatLngZoom(HAMBURG, 14));

                    // Zoom in, animating the camera.
                    map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null);  

You can change the code as per your requirement, This code is for your reference.

user3864262
  • 71
  • 2
  • 7
  • Thank you for answer, but there is one issue Marker is not pointing on exact lat long location – Reyaj Nov 11 '14 at 13:21
  • check lat long what you pass is same as map.google.com gives? , If you pass exact lat long then marker will point exactly the same. – user3864262 Nov 12 '14 at 07:13