private void killProcess(Context mAct) {
// TODO Auto-generated method stub
Log.i(TAG, "killProcess");
String packageName = mAct.getPackageName();
String processId = "";
try {
Runtime r = Runtime.getRuntime();
Process p = r.exec("ps");
BufferedReader br = new BufferedReader(new InputStreamReader(p
.getInputStream()));
String inline;
while ((inline = br.readLine()) != null) {
if (inline.contains(packageName)) {
Log.i(TAG, "" + inline);
break;
}
}
br.close();
StringTokenizer processInfoTokenizer = new StringTokenizer(inline);
int count = 0;
while (processInfoTokenizer.hasMoreTokens()) {
count++;
processId = processInfoTokenizer.nextToken();
if (count == 2) {
break;
}
}
Log.e(TAG, "kill process : " + processId);
r.exec("kill -15 " + processId);
} catch (IOException ex) {
Log.e(TAG, "" + ex.getStackTrace());
}
}