Exec And Wait : System « Development « Android

Home
Android
1.2D Graphics
2.Animation
3.Core Class
4.Database
5.Date Type
6.Development
7.File
8.Game
9.Hardware
10.Media
11.Network
12.Security
13.UI
14.User Event
Android » Development » System 
Exec And Wait
    
/*
    flashrec - a program to flash the recovery partition on Android devices.
    Copyright (C) 2009  Christopher Lais

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc.,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

//package org.zenthought.flashrec;

import java.io.IOException;

import android.util.Log;

class Util {
    public static boolean execAndWait(String[] args) {
        try {
            Process p = Runtime.getRuntime().exec(args);
            while (truetry {
                int code = p.waitFor();
                if (code != 0) { Log.d("FlashRec", String.format("%s exited with code %d", args[0], code))return false}
                return true;
            catch (InterruptedException e) {
                e.printStackTrace();
                continue;
            }
        catch (IOException e) {
            e.printStackTrace();
            return false;
        }
    }
}

   
    
    
    
  
Related examples in the same category
1.Run System Command
2.Get Process ID with shell command and read by Java code
3.Get App Name
4.Check For Installed App
5.Get Api Level
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.