2011-05-13 81 views
0

how to add overlay item in my current location in this code 這是我在我的當前位置添加了鋪設項目的代碼,但我得到這個錯誤錯誤在當前位置將覆蓋

enter code here 
public class MyLocationListener implements LocationListener 

{ @Override 

public void onLocationChanged(Location loc) 

      { 





GeoPoint point = new GeoPoint( (int) (loc.getLatitude() * 1E6), 
     (int) (loc.getLongitude() * 1E6)); 
mapOverlays = mapView.getOverlays(); 
drawable11 = this.getResources().getDrawable(R.drawable.vitblue); 
itemizedOverlay11= new HelloItemizedOverlay(drawable11,this); 
OverlayItem over11 = new OverlayItem(point, "offff", "over5"); 


itemizedOverlay11.addOverlay(over11); 

//構造HelloItemizedOverlay(可繪製,tryanabtry.MyLocationListener)是未定義

回答

0

確保你在項目中包含的類HelloItemizedOverlay和您正確調用構造函數....

+0

相信我有helloitemized覆蓋,但這個問題我怎樣才能調用構造函數正確地,它總是給出錯誤 – wowo 2011-05-13 22:15:32

+0

後,它強制關閉,當我運行程序 – wowo 2011-05-13 23:07:13

+0

後,我曾被問過同樣的事情,以及我認爲構造函數中的第二個參數是上下文,通過在這裏嘗試你的代碼.... – Farhan 2011-05-14 19:49:04