Screen capture in android

I successfully captured the screen with the following code.

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

But with this code the whole screen is captured. I want to capture only the components of a specific layout or area. Is this possible in android? Please help someone.

+4
source share
1 answer

What I got from your question, suppose you have an ImageView on your RelativeLayout, and you want the binding of this Imageview not to the entire RelativeLayout, than you have nothing to do.

Just use your code, instead of using relativelayout, using this view, which allows you to use ImageView in this case

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

All Articles