Я пытаюсь отобразить вывод в текстовом представлении.Но не в состоянии отобразить это.Я не знаю, не отображается ли это в моем пакете программ 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.TextView;
import java.util.*;
import android.util.*;
public class LinuxShellCommandAndroidProgramActivity extends Activity {
/** Called when the activity is first created. */
TextView tv;
public void onCreate(Bundle savedInstanceState) {
tv=new TextView(this);
super.onCreate(savedInstanceState);
try {
Process process = Runtime.getRuntime().exec("/system/bin/su");
DataOutputStream os = new DataOutputStream(process.getOutputStream());
DataInputStream is=new DataInputStream(process.getInputStream());
//os = new DataOutputStream(process.getOutputStream());
os.writeBytes("/system/bin/chmod 600 /data/data/newfile\n");
os.writeBytes("cd /data/data/dalvik-cache/\n");
os.writeBytes("/system/bin/ls -l /data/dalvik-cache\n");
String output=new String();
tv.setText("hii \n");
//setContentView(tv);
String temp = new String();
while((output=is.readLine())!=null)
{
Log.i("Check ",output);
tv.append(output);
}
setContentView(tv);
os.flush();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}