如何使Android上捕获屏幕应用程序 [英] How to make a capture screen app on Android

查看:233
本文介绍了如何使Android上捕获屏幕应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想打一个应用程序,它可以捕捉设备屏幕无根为:
https://play.google.com/store/apps/details?id=com.icecoldapps.screenshotultimate

I want to make an app which can capture device screen without root as: https://play.google.com/store/apps/details?id=com.icecoldapps.screenshotultimate

但我不能找到解决方案。
谁能帮助我?

But I can't find the solution. Anyone help me?

非常感谢你。

推荐答案

通过编程可以通过使用亚行执行下面的命令这样做的:

Programatically you can do so by executing the below command using adb:

adb shell /system/bin/screencap -p /sdcard/img.png

不过,从您可以使用下面的方法的应用程序做同样的:

However to do the same from an application you can use the below method:

Process sh = Runtime.getRuntime().exec("su", null,null); //getting superuser permission to access /system/bin
OutputStream  os = sh.getOutputStream();
os.write(("/system/bin/screencap -p " + "/sdcard/img.png").getBytes("ASCII")); //executing the command
os.flush();
os.close();
sh.waitFor();

/ SD卡/ 您将有 img.png 这将是你的屏幕截图。

In /sdcard/ you will have img.png which will be your screen shot.

这篇关于如何使Android上捕获屏幕应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆