public class CaptureActivity extends Activity {
static ImageView image1 = null;
Bitmap photo =null;
FrameLayout mFrameLayout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_capture);
Bundle b = getIntent().getExtras();
image1 = (ImageView) findViewById(R.id.image1);
photo = BitmapFactory.decodeFile(b.getString("path"));
image1.setImageBitmap(photo);
System.out.println("이미지 왼쪽값: "+ image1.getLeft());
System.out.println("이미지 오른값: "+ image1.getRight());
System.out.println("이미지 밑: " + image1.getBottom());
System.out.println("이미지 : "+ image1.getMeasuredWidth());
DrawView mDraw = new DrawView(this);
mFrameLayout = (FrameLayout) findViewById(R.id.frame);
mFrameLayout.addView(mDraw);
}
---------------------------------------------------------------------------------------------
public DrawView(Context context) {
super(context);
canvas = new Canvas();
paint = new Paint();
setFocusable(true);
point1 = new Point();
point1.x = ((CaptureActivity)context).getLeft();
point1.y = ((CaptureActivity)context).getTop();
Log.d(TAG,"context 왼쪽값"+((CaptureActivity)context).getRight() + " ");
Log.d(TAG,"context 윗값"+((CaptureActivity)context).getBottom() + " ");
point2 = new Point();
point2.x = ((CaptureActivity)context).getRight();
point2.y = ((CaptureActivity)context).getTop();
point3 = new Point();
point3.x = ((CaptureActivity)context).getRight();
point3.y = ((CaptureActivity)context).getBottom();
point4 = new Point();
point4.x = ((CaptureActivity)context).getLeft();
point4.y = ((CaptureActivity)context).getBottom();
액티비티에 이미지뷰에 꼭지점의 좌표를 얻어 오기를 원하는데 값을 찍어보니 getRight,getLeft 등 모두 0이 찍힙니다.
어떻게 해야 MyView로 이미지뷰의 크기를 얻을수 있을까요?
그리고 MyView 에서 액티비티를 호출할때 (( CaotyreActivity)context) 이방식 말고 다른 방법 없나요?
안드로이드 초보라서 고수님에 도움을 받고 싶습니다.