title: How to power off programmatically a rooted phone ?
body: <p>I want to power of my device programically my phone is rooted  but this command not power of my device what is wrong ? </p>
  
  <pre><code>            button.setOnClickListener(new OnClickListener() {
  
          @Override
          public void onClick(View arg0) {
                 Process chperm;
                  try {
                      chperm=Runtime.getRuntime().exec("su");
                        DataOutputStream os = 
                            new DataOutputStream(chperm.getOutputStream());
  
                            os.writeBytes("reboot -p\n");
                            os.flush();
  
  
  
                           chperm.waitFor();
  
                  } catch (IOException e) {
                      // TODO Auto-generated catch block
                      e.printStackTrace();
                  } 
                      catch (InterruptedException e) {
                      // TODO Auto-generated catch block
                      e.printStackTrace();
              }   
          }
      });
  </code></pre>
  
  <p>How do I power off device programtically ?</p>