【只是為了看看自己的目前技術水平】幫別人解決Android的技術問題,你有問題,把日志和問題寫清楚,共同進步哈,這個帖子長時間有效。
uj5u.com熱心網友回復:
public static String exec(String command) { Process process = null; BufferedReader reader = null; InputStreamReader is = null; DataOutputStream os = null; try { process = Runtime.getRuntime().exec("su"); is = new InputStreamReader(process.getInputStream()); reader = new BufferedReader(is); os = new DataOutputStream(process.getOutputStream()); os.writeBytes(command + "\n"); os.writeBytes("exit\n"); os.flush(); int read; char[] buffer = new char[4096]; StringBuilder output = new StringBuilder(); while ((read = reader.read(buffer)) > 0) { output.append(buffer, 0, read); } process.waitFor(); return output.toString(); } catch (IOException | InterruptedException e) { throw new RuntimeException(e); } finally { try { if (os != null) { os.close(); } if (reader != null) { reader.close(); } if (is != null) { is.close(); } if (process != null) { process.destroy(); } } catch (IOException e) { e.printStackTrace(); } } }不曉得為啥執行沒有效果,手機已經root了
uj5u.com熱心網友回復:
樓主,我想請問一下,為什么我的一個fragment跳到另一個fragment之后,再回傳到原來的fragment。會很卡很慢,這是什么原因?從fragment跳到activity再finish就不會卡,您知道這要怎么解決嗎?holder.back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
assert getFragmentManager() != null;
getFragmentManager().popBackStack();
}
});
這是我關閉該碎片的代碼
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/20389.html
標籤:Android
