我正在努力分享平板电脑显示屏上有多个表(全根)通过WiFi连接,我使用以下方法(所有内部一个线程):
1-我拍了一个屏幕截图.
Process sh = Runtime.getRuntime().exec("su", null,null);
OutputStream os = sh.getOutputStream();
os.write(("/system/bin/screencap -P " + "/sdcard/test/img.png").getBytes("ASCII"));
os.flush();
os.close();
sh.waitFor();
Run Code Online (Sandbox Code Playgroud)
2-压缩屏幕截图.
Bitmap mBitmap = BitmapFactory.decodeFile(Environment.getExternalStorageDirectory().getPath() + "/test/img.png");
OutputStream outputStream = null;
File file = new File(Environment.getExternalStorageDirectory().getPath() + "/test/img2.png");
outputStream = new FileOutputStream(file);
mBitmap.compress(Bitmap.CompressFormat.JPEG, 15, outputStream);
outputStream.flush();
outputStream.close();
Run Code Online (Sandbox Code Playgroud)
3-打开套接字并将压缩图像发送到另一个平板电脑.
这是有效但我的问题是在另一个平板电脑中观看延迟花了4-5秒刷新新显示器,有没有更好的方法让它实时显示?
我正在尝试根据标志更改列表视图中的某些项目文本颜色(或背景颜色).经过长时间的搜索,我没有找到如何做到这一点,我在改变颜色的具体行动后调用下面的循环:
ListView _listView = (ListView) findViewById(R.id.listView2);
for (int i=0;i<=_listView.getCount();i++)
{
if(Falg == True)
{
//here i want to change the list view item color or backgroud color
}
}
Run Code Online (Sandbox Code Playgroud) 我将我的应用程序设置为设备所有者,当我打电话时屏幕固定startLockTask().我现在的问题,当我尝试使用此方法运行另一个应用程序时:
Intent i = getPackageManager().getLaunchIntentForPackage("com.example.test");
startActivityForResult(i,Intent.FLAG_ACTIVITY_NEW_TASK);
Run Code Online (Sandbox Code Playgroud)
(什么都没发生)我要做什么让它运行?
编辑:我试过添加
dpm.setLockTaskPackages(deviceAdmin, new String[] { getPackageName() ,"com.example.test"});
Run Code Online (Sandbox Code Playgroud)
它也没有发布.