Home > Mobile >  [just to look at your current technical level] help others to solve the problem of Android technolog
[just to look at your current technical level] help others to solve the problem of Android technolog

Time:11-26

[just to look at your current technical level] help others solve the problem of Android technology, you have a problem, the problem of log and write clearly, make progress together, this post for a long time effectively,

CodePudding user response:

Public static String exec (String command) {Process Process=null; BufferedReader reader=null; InputStreamReader is=null; DataOutputStream OS=null; Try {process=Runtime. GetRuntime (). The 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. The flush (); Int read; Char [] buffer=new char [4096]. The StringBuilder output=new StringBuilder (); While ((read=reader. Read (buffer)) & gt; 0 {output. Append (buffer, 0, read); } process. WaitFor (); Return the output. The toString (); } the catch (IOException | InterruptedException e) {throw new RuntimeException (e); } finally {try {the if (OS!=null) {OS. The close (); } the if (reader!=null) {reader. The close (); } the if (is!=null) {is. The close (); } the if (the process!=null) {process. Destroy (); }} the catch (IOException e) {e.p rintStackTrace (); }}}

Don't know why the execution doesn't work, mobile phone has a root

CodePudding user response:

The building Lord, I would like to ask, why am I a fragment to another fragments, then return to their original fragments, it will be very card slowly, what reason is this? From fragment to the activity to finish wouldn't card, do you know this how to solve?

Holder. Back. SetOnClickListener (new View. An OnClickListener () {
@ Override
Public void onClick (View v) {
Assert getFragmentManager ()!=null;
GetFragmentManager (.) popBackStack ();
}
});
This is my close the fragments of code
  • Related