Sudipta Som
Sudipta Som

Reputation: 6577

Screen capture in android

I have successfully captured the screen with following code.

View v1 = relativeView.getRootView();
v1.setDrawingCacheEnabled(true);
Bitmap bm = v1.getDrawingCache();

But with this code whole screen is capturing. I want to capture only the components of a particular layout or area. Is this possible in android? Please some body help.

Upvotes: 4

Views: 1288

Answers (1)

ingsaurabh
ingsaurabh

Reputation: 15267

What I got from your question suppose you have ImageView on your RelativeLayout and you want the snap of that Imageview not the whole RelativeLayout than you have nothing to do.

Just use your code only instead of using relativelayout use that View lets say ImageView in this case

ImageView v1 = (ImageView)findViewById(R.id.mImage);
v1.setDrawingCacheEnabled(true);
Bitmap bm = v1.getDrawingCache();

Upvotes: 3

Related Questions