bitmap - Android - getDrawingCache - black screen -


I have read many posts on this topic, but none of them is helping.

I am trying to capture the screen shot of the current screen. For this I am using getDrawingCache. Here is my code:

  mRootView.get (). SetDrawingCacheEnabled (true); . MRootView.get () buildDrawingCache (); Bitmap screenshot = bitmap.creditbetaMap (mRootView.get (). GetDrawingCache ()); MRootView.get () setDrawingCacheEnabled (incorrect).  

The resulting bitmap is always black.

mRootView is a weak reference drawer layout, which is my root view.

Here's what I've tried:

  1. Adding a solution and layout call (though it should not be necessary because this code runs when a button is pressed, Then the scene should already be excluded).
  2. Before setting the layer type, set the LAYER_TYPE_NONE before you call the drawing cache enabled (true)
  3. Using a different view as the root view (for example, Dreverlayout Inside a ViewPager).

You can draw your view to the canvas -

Pass your main layout reference of this method -

  Bitmap file = save (layout); Bitmap save (see V) {bitmap b = bitmap.ctreitmap (v.getWidth), v.getHeight (), bitmap config.rg_8888); Canvas C = new canvas (B); V.draw (c); Return b; }  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -