public class A extends Activity
{
private B b;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
B.createInstance(this);
b = B.getInstance();
setContentView(b);
}
public void tmpFillRect(int x, int y, int w, int h, int color)
{
b.fillRect(x, y, w, h, color);
}
...
static {
System.loadLibrary("test");
}
}
public class B extends View
{
private static B instance = null;
private Canvas c;
private Bitmap b;
Paint p;
public B(Context context) {
super(context);
setBackgroundColor(Color.WHITE);
}
public static void createInstance(Context context) {
if(null == instance)
{
instance = new B(context);
}
}
public static B getInstance() {
return instance;
}
public void fillRect(int x, int y, int w, int h, int color) {
b = Bitmap.createBitmap(w, h, Bitmap.Config.RGB_565);
c = new Canvas(b);
p = new Paint();
color |= 0xff000000;
p.setColor(Color.BLUE);
Rect rect = new Rect(x, y, x + w, y + h);
c.drawRect(rect, p);
}
}
A class에서 B class에 있는 fillRect함수를 호출하여 사각형을 그리려고 합니다.
fillRect함수를 호출하는 tmpFillRect 함수는 test라이브러리에서 호출하도록 되어 있습니다.
사각형이 그려져야 정상인것 같은데 어떠한 이유에서인지 그려지지 않고 있습니다.
고수님들의 조언 부탁 드립니다.