2014-11-05 62 views

回答

-1

可以在線程開始計時,10秒後完成調用方法來顯示當前位置,

代碼主題: -

公共類CounterClass擴展CountDownTimer {

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

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


     } 

    } 

對於地點: -

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); 

您可以根據您的要求更改代碼,此代碼僅供您參考。

+0

謝謝你的回答,但有一個問題標記沒有指向確切的經緯度位置 – Reyaj 2014-11-11 13:21:24

+0

檢查經緯度你通過的是否與map.google.com相同?如果你通過精確的拉特,那麼標記將指向完全相同。 – user3864262 2014-11-12 07:13:02

相關問題