how to execute "adb logcat -d time > pathoffile\log.txt &" programatically 
<p>I want to execute the "adb logcat -d time > pathoffile\log.txt &amp;" in my java code.</p>

<p>I want to create my log.txt in my device.</p>

<p>I wrote this code to do this.</p>

<pre><code> ArrayList&lt;String&gt; commandLine = new ArrayList&lt;String&gt;();
        commandLine.add("logcat");
        commandLine.add("-d");
        commandLine.add("time");
        commandLine.add("&gt;");
        commandLine.add(getApplicationContext().getFilesDir()
        //      + "/log.txt");   //already created the file at specified location.
        //commandLine.add("&amp;");
Process process = Runtime.getRuntime().exec(commandLine.toArray(new String[0]));
</code></pre>

<p>The above code not throwing any error , but my file (log.txt) is not updating with the log statements..</p>

<p>please help me in this how to do this, pl. suggest if there's any alternative to do this..
thanks.</p>
