在开发中,有时我们需要在后台循环执行一些操作(比如:即时通讯心跳包的发送)。
xml布局文件:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <Button android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:onClick="start" android:text="开始" /> </RelativeLayout>