I want to implement a button on my app that can let the user take a screenshot of the app and then share it as image on social networks, but I don't know how to do that, I've tried with Bitmap but didn't work.
This is what I've done, but is not working:
public static Bitmap getScreenShot(View view) {
View screenView = view.getRootView();
screenView.setDrawingCacheEnabled(true);
Bitmap bitmap = Bitmap.createBitmap(screenView.getDrawingCache());
screenView.setDrawingCacheEnabled(false);
return bitmap;
}
Hope you can help me :D