繁体   English   中英

Android:如何跟踪键盘使用情况

[英]Android : How to track Keyboard usage

有没有办法跟踪用户在软键盘上的“速度”? 我想知道用户在使用键盘时花费的时间。

我希望我的问题很清楚!

您可以在 EditText 中使用文本观察器,并且在每次文本更改时您都可以计算时间差异。

long intialTime=System.getCurrentTimeMillis();
long total = 0;

editText.addTextChangedListener(new TextWatcher() {  
  
            @Override  
            public void onTextChanged(CharSequence cs, int arg1, int arg2, int arg3) {  
                total= total + (System.getCurrentTimeMillis()-initialTime)
                intialTime = System.getCurrentTimeMillis();
            }  
  
            @Override  
            public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) 
            {  
               
            }  
  
            @Override  
            public void afterTextChanged(Editable arg0) {  
                
            }  
        });

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM