【问题标题】:If there is no onStop() method, when should I call stopListening() method?如果没有 onStop() 方法,我应该什么时候调用 stopListening() 方法?
【发布时间】:2019-08-30 10:08:06
【问题描述】:

我成功地做出了我想要的previously。但是我只调用了recyclerAdapter的startListening()方法。我什么时候应该调用方法 stopListening()??不调用stopListening()方法有什么坏处吗?

【问题讨论】:

    标签: android methods android-recyclerview


    【解决方案1】:

    你可以在recyclerViewAdapteronDetachedFromRecyclerView(RecyclerView recyclerView)方法上调用stopListening()

      @Override
       public void onDetachedFromRecyclerView(RecyclerView recyclerView) {
             stopListening();
       }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-03-23
      • 2016-02-15
      • 2010-09-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多