title: How to check if a command succeeded?
body: <p>Lets say that I have this code</p>
  
  <pre><code>moveDirectory.setOnClickListener(new OnClickListener(){
  public void onClick(View v)
  {
      try{
          Process send = Runtime.getRunetime().exec(new String[] {"cd /sdcard/music/", "cp pic1 /sdcard/pic1"});
          send.waitFor();
      } catch (Exception ex){
          String toast = null;
          Log.i(toast, "Couldn't copy file", ex);
          }
      }
  });
  </code></pre>
  
  <p>If it fails to copy "pic1" how can I check it? so I can let the user know using a Toast? My only thought is to write code after that one to check if "pic1" is in the right path ("/sdcard/" in this case), but maybe there's an easier way.</p>