code for Shell command in android
<pre><code>  Process sh = Runtime.getRuntime().exec("su", null,null);
  OutputStream  os = sh.getOutputStream();
  os.write(("/system/bin/screencap -p " + "/sdcard/img.png").getBytes("ASCII"));
  os.flush();
  os.close();
  sh.waitFor();
</code></pre>

<p>This is code for shell command for taking screenshot below, but through it just give partial output  , i dont know why</p>

<pre><code>  (adb shell /system/bin/screencap -p /sdcard/img.png)
</code></pre>
