Android getResource() undefined error

前端 未结 2 2063
天命终不由人
天命终不由人 2021-02-15 15:42

I want to draw bitmap on draw method in MyPositionOverlay extends Overlay class but I get this error: The method getResource() is undefined for the type MyPositionOverlay

2条回答
  •  名媛妹妹
    2021-02-15 16:45

    use

       Bitmap bmp = BitmapFactory.decodeResource(this.getResources(), R.drawable.icon); 
    

    or

    Bitmap bmp = BitmapFactory.decodeResource(Context.getResources(), R.drawable.icon); 
    

提交回复
热议问题