title: Rsync in android
body: <p>Finally i am able to run super user commands in android program. Now i want to rsync a few files from my phone to my laptop and here comes the problem. rsync needs password to be given and i am not understanding how to give password of my laptop to this android program. There are ways in which rsync can be done using private/public keys. But what i want in general is that how do i feed input to rsync or for that matter any command through keyboard...Here i am attaching my program...</p>
  
  <pre><code>package com.iiitb.nikhil.sindhu;
  
  import java.io.BufferedReader;
  import java.io.DataInput;
  import java.io.DataInputStream;
  import java.io.DataOutputStream;
  import java.io.IOException;
  import java.io.InputStreamReader;
  
  import android.app.Activity;
  import android.os.Bundle;
  import android.util.Log;
  import android.widget.LinearLayout;
  import android.widget.TextView;
  import java.util.*;
  import android.util.*;
  
  
  public class LinuxShellCommandAndroidProgramActivity extends Activity {
      /** Called when the activity is first created. */
  
      TextView tv;
      LinearLayout l;
      public void onCreate(Bundle savedInstanceState) {
  
          super.onCreate(savedInstanceState);
  
          try {
              Process process = Runtime.getRuntime().exec("/system/bin/su");
              DataOutputStream os = new DataOutputStream(process.getOutputStream());
              DataInputStream is=new DataInputStream(process.getInputStream());
              tv = new TextView(this);
              os.writeBytes("/system/xbin/rsync  /data/data/newfiles sindhu@192.168.2.103:/home/sindhu/");
              String output=new String();
              String temp = new String();
              output=is.readLine();
              tv.setText(output);
              os.flush();
       } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
      }finally {
          setContentView(tv); }
  
      }
  }
  </code></pre>
  
  <p>In the above i am trying to do rsync from my phone to my laptop..the above command would ask for the password but i am not understanding how to give input to this android program</p>