Runtime runtime = Runtime.getRuntime();
Process process;
try
{
String cmd = "ls";
process = runtime.exec(cmd);
BufferedReader br =
new BufferedReader(new InputStreamReader(process.getInputStream()));
String line = "";
while ((line = br.readLine()) != null)
{
System.out.println(line);
}
br.close();
}
catch (Exception e)
{
e.fillInStackTrace();
Log.e("Process Manager", "Unable to execute top command");
}
저는 지금 안드로이드 소스로 Shell 프롬프트 Command 실행과 출력을 안드로이드 디스플레이로 하려고 하고 있습니다.
c언어는 조금 해봤으나 안드로이드와 자바는 초보라 인터넷에 나와 있는 소스코드를 어떻게 적용해야 하는지 몰라서 소스
코드가 제대로 인지 디스플레이가 안되는지조차 판단이 안되고 있습니다.
실행하면 텍스트 창 그대로 나오며
MainActivity에 넣어야하는지 xml 이나 manifest의 설정은 어떻게 해야하는건지 중심 좀 잡아주세요 ㅜ