这是一个简单的使用Looper 和 Handler 来实现消息的传递。没有什么值得交代的,直接附上参考源码。
布局文件 dlp_main.xml源码如下:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_marginLeft="10dp"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/tv_show"
android:text="This is Simple Demo for Looper_Handler."
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
android:id="@+id/btn_start"
android:text="Start"
android:textAllCaps="false"
android:layout_width="match_parent