一:Log日志工具类

一个android应用程序运行后 并不会在 ide的控制台内输出任何信息. 不能在控制台输出。但是android提供的Log类。

在程序中输出日志, 使用 android.util.Log 类.
该类提供了若干静态方法

Log.v(String tag, String msg);
Log.d(String tag, String msg);
Log.i(String tag, String msg);
Log.w(String tag, String msg);
Log.e(String tag, String msg);

分别对应 Verbose, Debug, Info, Warning,Error.

tag是一个标识,可以是任意字符串,通常可以使用类名+方法名, 主要是用来在查看日志时提供一个筛选条件.


二:程序中打日志

<strong><span style="font-size:18px;">  public void test(View view) {    Log.i("test", "进入test函数");//findViewByIdTextView textView = (TextView) findViewById(R.id.textView1);textView.setText(R.string.textChange);//ToastToast toast = Toast.makeText(MainActivity.this, "点击了Button",Toast.LENGTH_SHORT); //屏幕居中显示,X轴和Y轴偏移量都是0  toast.setGravity(Gravity.CENTER, 0, 0);toast.show();}</span></strong>


三:LogCat截图


更多相关文章

  1. Android(安卓)日志级别总结
  2. 67-Flutter中高德地图插件的使用
  3. Android(安卓)JNI打印Log
  4. python logging 模块(一)
  5. android:The application has stopped unexpectedly, please try
  6. android sqlite3命令
  7. android 合并录音文件
  8. 将获取的html源代码格式化输出
  9. 日志工具类

随机推荐

  1. android学习----通过android帮助,学习Text
  2. android源码下载-Windwos下使用清华镜像
  3. Android(安卓)使用XML隐藏ActionBar中遇
  4. Ubuntu 16.04 64bit 编译 Android(安卓)4
  5. interview-question
  6. Android(安卓)以singleInstance模式加载
  7. Context上下文的一些应用
  8. EditText常用属性【一】:空白提示/文本域
  9. android学习笔记29:simpleAdapter
  10. 别人看的书,拿来参考