EventBus广播
来源:互联网 发布:淘宝客推广的入口 编辑:程序博客网 时间:2024/05/16 17:54
package com.example.pulltorefreshlistview;import android.os.Bundle;import android.support.v7.app.AppCompatActivity;import android.view.View;import android.widget.Toast;import com.handmark.pulltorefresh.library.PullToRefreshListView;import de.greenrobot.event.EventBus;import de.greenrobot.event.Subscribe;import de.greenrobot.event.ThreadMode;public class MainActivity extends AppCompatActivity { private PullToRefreshListView refersh; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); EventBus.getDefault().register(this); } public void on(View view) { EventBus.getDefault().post("我想换电脑"); } @Subscribe(threadMode = ThreadMode.MainThread) public void getMsg(String str){ Toast.makeText(this,str,Toast.LENGTH_SHORT).show(); } @Override protected void onDestroy() { super.onDestroy(); EventBus.getDefault().unregister(this); }}
阅读全文
0 0
- EventBus广播
- EventBus实现广播接收
- Android 广播、EventBus、观察者模式
- EventBus实现广播的接受
- EventBus实现广播与Activity通讯
- Android 类似广播的增强版框架-EventBus
- 代替Android广播,eventbus的创建与使用
- EventBus
- EventBus
- EventBus
- EventBus
- EventBus
- EventBus
- EventBus
- EventBus
- EventBus
- EventBus
- EventBus
- 电影《芳华》名利双收,与华谊的对赌协议让冯小刚憋出了大招
- XRecyclerView的刷新方法(自用,有瑕疵)
- 自己设置mapreduce程序的map个数和reduce个数
- VMware ContentOS7 配置网络
- Maven pom.xml依赖ojdbc架包提示Missing artifact com.oracle:ojdbc14:jar:10.2.0.4.0
- EventBus广播
- 关于Jedis连接Linux上的redis出现 DENIED Redis is running in protected mode问题的解决方案
- tabla
- Python
- 647 Palindromic Substrings
- shiro 简介
- Python Web后台一些面试经历
- Vim使用笔记
- Xreaycle设置可上拉下拉