Remove All Ads from XDA
Honor View 10

[Help] Android GUI for privoxy+polipo

2 posts
Thanks Meter: 0
By alaa92, Junior Member on 8th July 2014, 02:41 AM
Post Reply Email Thread
How are you?
I have make simple android GUI to start privoxy and polipo binary
but my problem.How i can stop privoxy and polipo when press on stop button

i can get process id (PID) for privoxy and polipo using this code

public int findProcessIdWithPS(String str) throws IOException {
        String readLine;
        Runtime runtime = Runtime.getRuntime();
        CharSequence name = new File(str).getName();
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(runtime.exec("ps " + name).getInputStream()));
        do {
            readLine = bufferedReader.readLine();
            if (readLine == null) {
                return -1;
        } while (!readLine.contains(name));
        return Integer.parseInt(readLine.split("\\s+")[1]);
this code return the PID of process
then i have try kill process but not working with this code

	        Process process = Runtime.getRuntime().exec("kill -9 " + findProcessIdWithPS("privoxy"));
but this code not working with me

Please any help
Sorry of my English
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes