Android Log详解
来源:互联网 发布:mac taupe 试色 编辑:程序博客网 时间:2024/05/16 10:56
Step 1:准备工作(打开LogCat视窗).
Step 2:新建一个Android工程,命名为LogDemo.
Step 3:设计UI界面,我们在这里就加了一个Button按钮(点击按钮出现Log日志信息).
Main.xml代码如下:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
<Button
</LinearLayout>
Step 4:设计主类LogDemo.java,代码如下:
package com.android.test;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
public class LogDemo extends Activity
{
private static final String ACTIVITY_TAG="LogDemo";
public void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//通过findViewById找到Button资源
bt=(Button)findViewById(R.id.bt);
//增加事件响应
bt.setOnClickListener(new Button.OnClickListener()
});
}
}
Step 5:运行LogDemo工程,效果如下:
当我们点击按钮时,会触发事件,在Logcat视窗下有如下效果:
本文转载自:http://blog.sina.com.cn/s/blog_8ae46d150101195q.html
- Android Log详解
- Android Log详解
- Android Log详解
- Android 系统log详解
- Android Log系统详解
- android log 等级详解
- android Log详解
- Android的Log图文详解(Log.v,Log.d,Log.i,Log.w,Log.e)!
- Android的Log图文详解(Log.v,Log.d,Log.i,Log.w,Log.e)
- Android的Log图文详解(Log.v,Log.d,Log.i,Log.w,Log.e)
- Android的Log图文详解(Log.v,Log.d,Log.i,Log.w,Log.e)!
- Android Log图文详解(Log.v,Log.d,Log.i,Log.w,Log.e)
- Android教程----Log图文详解(Log.v,Log.d,Log.i,Log.w,Log.e)!
- Android Log图文详解(Log.v,Log.d,Log.i,Log.w,Log.e)! .
- android Log图文详解(Log.v,Log.d,Log.i,Log.w,Log.e)
- Android的Log图文详解(Log.v,Log.d,Log.i,Log.w,Log.e)
- android Log图文详解(Log.v,Log.d,Log.i,Log.w,Log.e)
- android Log图文详解(Log.v,Log.d,Log.i,Log.w,Log.e)
- 使用Lucene-Spatial实现集成地理位置的全文检索
- 安卓手机开机动画制作原理教程
- ActionScript Worker 新特性初步分析总结
- 电话号码等数字型输入
- webservice传输大文件
- Android Log详解
- java中memcached作为hibernate的二级缓存
- [转]宽带带宽对应的下载速率
- ubuntu下J2EE环境配置(MyEclipse+MySQL+tomcat+jdk1.5)
- 脚本语言perl,shell,python学习论坛及网站
- ORACLE触发器语法
- 使用Spring AOP进行性能监控
- vim ctags使用方法
- 国土档案管理信息系统【数据检查】-各类型档案数据检查