开发者

Taking a screenshot but shows 0 KB file in android?

I had to take a screen开发者_JAVA百科shot 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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜