protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_capture);
Bundle b = getIntent().getExtras();
image1 = (ImageView) findViewById(R.id.image1);
photo = BitmapFactory.decodeFile(b.getString("path"));
image1.setImageBitmap(photo);
mFrameLayout = (RelativeLayout) findViewById(R.id.frame);
controlInflater = LayoutInflater.from(getBaseContext());
View viewControl = controlInflater.inflate(R.layout.control2, null);
LayoutParams layoutParamsControl = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
this.addContentView(viewControl, layoutParamsControl);
// mDraw.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),
// MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
Button cancle = (Button) findViewById(R.id.cancle);
cancle.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
Button crop = (Button) findViewById(R.id.crop);
crop.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.d("리소스값", ""+bit);
Log.d("리소스값", ""+mDraw.getResources());
Log.d("id 값", ""+R.id.cropImage);
if(bit !=null) {
Intent intent = new Intent(getBaseContext(), ClipActivity.class);
intent.putExtra("Bitmap", bit);
startActivity(intent);
}
}
});
}
public void onWindowFocusChanged(boolean hasFocus) {
imageLeft = image1.getLeft();
imageRight = image1.getRight();
imageBottom = image1.getTop();
imageTop = image1.getBottom();
if(mDraw == null) {
mDraw = new DrawView(this);
//mDraw.setId(100);
//mDraw.measure(imageRight, imageBottom);
mFrameLayout.addView(mDraw);
}
else
bit = mDraw.getDrawingCache();
}
이미지 뷰위에 다른뷰를 올려서 그림을 그렸습니다. 그런데 이것을 getDrawingCache(); 써서 넘기려고 하니 null값만 들어 오네요. 위에 소스에서 bit이 null값이 들어가는지 모르겠습니다.
고수님들의 답변 부탁드립니다.