设为首页 加入收藏

TOP

Android中保存Logcat信息到文件(二)
2014-11-23 23:19:40 来源: 作者: 【 】 浏览:19
Tags:Android 保存 Logcat 信息 文件
&& (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;
}
}
}


}
}



然后在应用启动和退出时关闭管理器就行


-------------------------------------------分割线-------------------------------------------


-------------------------------------------分割线-------------------------------------------


首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Intellij IDEA创建Maven Web项目 下一篇Java常用数据加密算法

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: