Info

& ft tfp mJ w iffl H a «x £ tit Sc ft lilt # is i jf* Sfc tfir $ MX: i ft] ft ft «* £ £ M & ft (u & W&i r W f ,'i & Mxsiitt API ii{jt-M«n#JK. mumm.^m^^, API

;fi«fflKMM%mMt j *Otto 1:. AnXifrffftS Java

«ft!. N B/>y.Li««JKT M7FK&.&• Kiftf ■«««fcflUi'Hiilifc. M-tt^fli.^ Will Fffr>r<:

public class CMDExeeute {

public synchronized String run(St ring[1 cmd, String workdirectory) throws IOException I String result -

try I

ProcessBuilder builder new Process.Builder (cmd) ;

if (workdirectory ! null)

builder.directory(new File(workdirectory)); builder.redirect ErrorStream(true); Process process = builder.start(); InputStream ir. = process.getlnputStream() ; byte| | re - new byte(1024]; while (in.read(re) != -i) ( System.Out.print In(new String(re)); result - result. » new String(re); )

I catch (Exception ex) ex.printStackTrace(); )

return result;

h&itPM', CMDExecute.java M^ttttttilfKj^, Jf-fiMiS-JR. It ttJIJ?/fclfc«tSf*L. ffiiMi^:>fifjHifijfi<j1'iM41iv:fi'i/i HJJ.

^IKtnuiinMftfigMfeiJ. Mmft* ft® 16.2.1

<?xml version-"!.0" encoding-"utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

android: or ientation="vertical" android: layout. width="fill parent" androi d:layout height="filL parent">

<Li stView android:layout width="fill_parent" android: I ayout_height "fill_parent" android:id -fid/itemlist" /> </LinearLayout>

main.xml 'I'ftfiJfJMii LinearLayout fllir.',, Jt'l'/A'HT t ListView gift". KMe oeinfosAssistantjava fm , IkM^ftUf-fft '¿'ft 4 £

0 0

Post a comment