0

I had to take a screenshot that can be later saved in SD card. I have gone through the code given at below this link.

Android take screenshot via code

problem is that it creates a zero(0) kb file in my Sd card. what could be the problem? and what is id.layoutroot?

Community
  • 1
  • 1
arpit
  • 1

1 Answers1

0

layoutroot is most likely the id given to the root layout as in

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/layoutroot"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content">
... 
... (other ui items)

Try to use the id of the view you want to capture and check if the drawing cache is enabled.

mibollma
  • 14,959
  • 6
  • 52
  • 69