오버레이에서 확장 한 클래스 MiOverlay를 만들었습니다.android에서 getResources를 사용하는 방법
그리고 getResources 메소드를 인식하지 못합니다. 어떻게해야합니까? 여기에 내 수업
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Point;
import android.location.Location;
import com.google.android.maps.MapView;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.Overlay;
public class MiOverlay extends Overlay {
GeoPoint point;
public MiOverlay(GeoPoint point)
{
super();
this.point = point;
}
@Override
public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when){
super.draw(canvas, mapView, shadow);
Point scrnPoint = new Point();
mapView.getProjection().toPixels(this.point, scrnPoint);
Bitmap marker = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
canvas.drawBitmap(marker, scrnPoint.x - marker.getWidth()/2, scrnPoint.y - marker.getHeight() /2 , null);
return true;
}
리소스를 참조 할 때 컨텍스트가 필요하다고 생각합니다. – zgc7009