Reputation: 714
I am using Runtime.getRuntime().exec("logcat -f log.txt -c");
In my android application.
The problem with is is that it keeps running and never stops.
Is there a command to stop the code/adb command from executing?
Upvotes: 0
Views: 1299
Reputation: 2320
You can use this code
Process proc = Runtime.getRuntime().exec("logcat -f log.txt -c"); // Deletes log.txt
proc.destroy();//kill the process
You can use proc.destroy();
in onClick()
if you want to destroy the logcat
when click the button or Handler
if you want to destroy it in several seconds or onDestroy()
if you want to destroy it when the app destroyed and so on.
Upvotes: 2