&& (line = mReader.readLine()) != null)
{
if (!mRunning)
{
break;
}
if (line.length() == 0)
{
continue;
}
if (out != null && line.contains(mPID))
{
out.write((simpleDateFormat2.format(new Date()) + " " + line + "\n").getBytes());
}
}
}
catch (IOException e)
{
e.printStackTrace();
}
finally
{
if (logcatProc != null)
{
logcatProc.destroy();
logcatProc = null;
}
if (mReader != null)
{
try
{
mReader.close();
mReader = null;
}
catch (IOException e)
{
e.printStackTrace();
}
}
if (out != null)
{
try
{
out.close();
}
catch (IOException e)
{
e.printStackTrace();
}
out = null;
}
}
}
}
}
然后在应用启动和退出时关闭管理器就行
-------------------------------------------分割线-------------------------------------------
-------------------------------------------分割线-------------------------------------------