zoukankan      html  css  js  c++  java
  • RxJava RxBinding 按钮(Button) 点击(click)

    /*********************************************************************
     *             RxJava RxBinding 按钮(Button) 点击(click)
     * 说明:
     *     之前看了RxJava相关内容,但对于本人来说目前更倾向于从使用中来学
     * 习,结果发现找个Button点击的示例都没找到,刚刚在google上找到这两篇
     * 文章中有介绍,记录一下。
     *
     *                                    2016-9-8 深圳 南山平山村 曾剑锋
     ********************************************************************/
    
    一、参考文档:
        1. RxJava
            https://guides.codepath.com/android/RxJava
        2. RxJava and RxBinding
            https://guides.codepath.com/android/RxJava-and-RxBinding#overview
    
    二、配置:
        相关配置请参考《参考文档》里的两篇文档。
    
    三、Button示例:
        Button button = (Button)findViewById(R.id.button);
        Subscription buttonSub = RxView.clicks(button).subscribe(new Action1<Void>() {
            @Override
            public void call(Void aVoid) {
                //handle on click here
            }
        }); 
            
    四、EditText示例:
        EditText editText = (EditText)findViewById(R.id.editText);
        Subscription editTextSub = RxTextView.textChanges(editText).subscribe(new Action1<String>() {
            @Override
            public void call(String value) {
               // do some work with new text
            }
        });
  • 相关阅读:
    express4.x socket
    validator
    服务管理,Dll查看
    复制程序,获取系统信息
    TCP HelloWord
    UDP HelloWord
    [置顶] 一个小马
    注册表编辑
    服务的启动与停止
    自下载运行
  • 原文地址:https://www.cnblogs.com/zengjfgit/p/5852730.html
Copyright © 2011-2022 走看看