w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to convert .raw file to image file in android rooted device programmatically

if raw is image file then u can change extentention to jpg or png,

File ss = new File(ssDir, "ss.raw");

change this to

   File ss = new File(ssDir, "ss.jpg");

but capturing screenshots require root permission to execute su permission

 File f = new
File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES),
"screeshot.jpg");
Process localProcess  = Runtime.getRuntime().exec("su");
OutputStream  os = localProcess .getOutputStream();
 //DataOutputStream  dos = (DataOutputStream)
localProcess.getOutputStream();
os.write(("/system/bin/screencap -p " + f.toString()).getBytes("ASCII"));
//dos.writeBytes("exit
");
os.flush();
os.close();
localProcess .waitFor();




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.