重新构建回收视图会导致它消失。

huangapple go评论100阅读模式
英文:

Rebuilding the recycler view causes it to disappear

问题

My Fragments OnViewCreated code

  1. public void onViewCreated(View view, Bundle savedInstanceState) {
  2. super.onViewCreated(view, savedInstanceState);
  3. final String id = FirebaseAuth.getInstance().getCurrentUser().getUid();
  4. search_keyword = getView().findViewById(R.id.exp_search);
  5. search_btn = getView().findViewById(R.id.exp_search_btn);
  6. ccp = getView().findViewById(R.id.exp_ccp);
  7. refresh = getView().findViewById(R.id.refresh);
  8. country = ccp.getSelectedCountryName();
  9. setUpRecyclerView(country);
  10. Log.e("explore frag","1");
  11. db.collection("Users").document(id).collection("preferences").document("event").get().addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() {
  12. @Override
  13. public void onComplete(@NonNull Task<DocumentSnapshot> task) {
  14. if (task.isSuccessful()) {
  15. DocumentSnapshot documentSnapshot = task.getResult();
  16. if (documentSnapshot.exists()) {
  17. String anime = documentSnapshot.get("anime").toString();
  18. String art = documentSnapshot.get("art").toString();
  19. String edu = documentSnapshot.get("edu").toString();
  20. String gaming = documentSnapshot.get("gaming").toString();
  21. String music = documentSnapshot.get("music").toString();
  22. String other = documentSnapshot.get("other").toString();
  23. String all = documentSnapshot.get("all").toString();
  24. String search_key = search_keyword.getText().toString().trim();
  25. country = ccp.getSelectedCountryName();
  26. if (all.equals("1") && TextUtils.isEmpty(search_key)) {
  27. setUpRecyclerView(country);
  28. Log.e("explore frag","2");
  29. } else if (all.equals("1") && !(TextUtils.isEmpty(search_key))) {
  30. setUpRecyclerViewWithKeyword(country, search_key);
  31. Log.e("explore frag","3");
  32. } else if (all.equals("0") && TextUtils.isEmpty(search_key)) {
  33. setUpRecyclerViewWithPreferences(country, anime, art, edu, gaming, music, other);
  34. Log.e("explore frag","4");
  35. } else {
  36. setUpRecyclerViewWithKeywordAndPreferences(country, search_key, anime, art, edu, gaming, music, other);
  37. Log.e("explore frag","5");
  38. }
  39. }
  40. }
  41. }
  42. }).addOnFailureListener(new OnFailureListener() {
  43. @Override
  44. public void onFailure(@NonNull Exception e) {
  45. }
  46. });
  47. adapter.setOnItemClickListener(
  48. new ExplorePageAdapter.OnItemClickListener() {
  49. @Override
  50. public void OnItemClick(DocumentSnapshot documentSnapshot, int position) {
  51. String id = documentSnapshot.getId();
  52. Intent intent = new Intent(getActivity(), event_customer_view_activity.class);
  53. intent.putExtra("Event_ID", id);
  54. startActivity(intent);
  55. }
  56. }
  57. );
  58. }

RecylerView building method

  1. private void setUpRecyclerView(String country) {
  2. Log.e("explore frag", country);
  3. Query query = Cref.whereEqualTo("country", country);
  4. FirestoreRecyclerOptions<POJO_explore_page_item> options = new
  5. FirestoreRecyclerOptions.Builder<POJO_explore_page_item>()
  6. .setQuery(query, POJO_explore_page_item.class)
  7. .build();
  8. adapter = new ExplorePageAdapter(options);
  9. RecyclerView recyclerView = getView().findViewById(R.id.explore_recycler);
  10. recyclerView.setHasFixedSize(true);
  11. recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
  12. recyclerView.setAdapter(adapter);
  13. }

Attempted solutions:

I have tried adding recyclerView.setAdapter(null); and recyclerView.setLayoutManager(null); before

  1. recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
  2. recyclerView.setAdapter(adapter);

I have also tried rebuilding the recycler view in my OnViewCreated method

  1. public void onViewCreated(View view, Bundle savedInstanceState) {
  2. super.onViewCreated(view, savedInstanceState);
  3. final String id = FirebaseAuth.getInstance().getCurrentUser().getUid();
  4. search_keyword = getView().findViewById(R.id.exp_search);
  5. search_btn = getView().findViewById(R.id.exp_search_btn);
  6. ccp = getView().findViewById(R.id.exp_ccp);
  7. refresh = getView().findViewById(R.id.refresh);
  8. country = ccp.getSelectedCountryName();
  9. Log.e("explore frag",country);
  10. Query query = Cref.whereEqualTo("country", country);
  11. FirestoreRecyclerOptions<POJO_explore_page_item> options = new
  12. FirestoreRecyclerOptions.Builder<POJO_explore_page_item>()
  13. .setQuery(query, POJO_explore_page_item.class)
  14. .build();
  15. adapter = new ExplorePageAdapter(options);
  16. final RecyclerView recyclerView = getView().findViewById(R.id.explore_recycler);
  17. recyclerView.setHasFixedSize(true);
  18. recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
  19. recyclerView.setAdapter(adapter);
  20. Log.e("explore frag","1");
  21. // ... (remaining code)
  22. }

Neither of these two attempts worked. Any suggestions?

英文:

In my code, I am building a recycler view, via the methodsetUpRecyclerView(country);, when my fragment is fast created and later on I call the same method (or various other methods that build a recycler view e.g.setUpRecyclerViewWithKeyword(country, search_key); , setUpRecyclerViewWithPreferences(country, anime, art, edu, gaming, music, other); , setUpRecyclerViewWithKeywordAndPreferences(country, search_key, anime, art, edu, gaming, music, other); ) to build the recyler view again. This is illustrated below:

My Fragments OnViewCreated code

  1. public void onViewCreated(View view, Bundle savedInstanceState) {
  2. super.onViewCreated(view, savedInstanceState);
  3. final String id = FirebaseAuth.getInstance().getCurrentUser().getUid();
  4. search_keyword = getView().findViewById(R.id.exp_search);
  5. search_btn = getView().findViewById(R.id.exp_search_btn);
  6. ccp = getView().findViewById(R.id.exp_ccp);
  7. refresh = getView().findViewById(R.id.refresh);
  8. country = ccp.getSelectedCountryName();
  9. setUpRecyclerView(country);
  10. Log.e(&quot;explore frag&quot;,&quot;1&quot;);
  11. db.collection(&quot;Users&quot;).document(id).collection(&quot;preferences&quot;).document(&quot;event&quot;).get().addOnCompleteListener(new OnCompleteListener&lt;DocumentSnapshot&gt;() {
  12. @Override
  13. public void onComplete(@NonNull Task&lt;DocumentSnapshot&gt; task) {
  14. if (task.isSuccessful()) {
  15. DocumentSnapshot documentSnapshot = task.getResult();
  16. if (documentSnapshot.exists()) {
  17. String anime = documentSnapshot.get(&quot;anime&quot;).toString();
  18. String art = documentSnapshot.get(&quot;art&quot;).toString();
  19. String edu = documentSnapshot.get(&quot;edu&quot;).toString();
  20. String gaming = documentSnapshot.get(&quot;gaming&quot;).toString();
  21. String music = documentSnapshot.get(&quot;music&quot;).toString();
  22. String other = documentSnapshot.get(&quot;other&quot;).toString();
  23. String all = documentSnapshot.get(&quot;all&quot;).toString();
  24. String search_key = search_keyword.getText().toString().trim();
  25. country = ccp.getSelectedCountryName();
  26. if (all.equals(&quot;1&quot;) &amp;&amp; TextUtils.isEmpty(search_key)) {
  27. setUpRecyclerView(country);
  28. Log.e(&quot;explore frag&quot;,&quot;2&quot;);
  29. } else if (all.equals(&quot;1&quot;) &amp;&amp; !(TextUtils.isEmpty(search_key))) {
  30. setUpRecyclerViewWithKeyword(country, search_key);
  31. Log.e(&quot;explore frag&quot;,&quot;3&quot;);
  32. } else if (all.equals(&quot;0&quot;) &amp;&amp; TextUtils.isEmpty(search_key)) {
  33. setUpRecyclerViewWithPreferences(country, anime, art, edu, gaming, music, other);
  34. Log.e(&quot;explore frag&quot;,&quot;4&quot;);
  35. } else {
  36. setUpRecyclerViewWithKeywordAndPreferences(country, search_key, anime, art, edu, gaming, music, other);
  37. Log.e(&quot;explore frag&quot;,&quot;5&quot;);
  38. }
  39. }
  40. }
  41. }
  42. }).addOnFailureListener(new OnFailureListener() {
  43. @Override
  44. public void onFailure(@NonNull Exception e) {
  45. }
  46. });
  47. adapter.setOnItemClickListener(
  48. new ExplorePageAdapter.OnItemClickListener() {
  49. @Override
  50. public void OnItemClick(DocumentSnapshot documentSnapshot, int position) {
  51. String id = documentSnapshot.getId();
  52. Intent intent = new Intent(getActivity(),
  53. event_customer_view_activity.class);
  54. intent.putExtra(&quot;Event_ID&quot;, id);
  55. startActivity(intent);
  56. // getActivity().finish();
  57. }
  58. }
  59. );
  60. }

RecylerView building method

  1. private void setUpRecyclerView(String country) {
  2. Log.e(&quot;explore frag&quot;,country);
  3. Query query = Cref.whereEqualTo(&quot;country&quot;, country);
  4. FirestoreRecyclerOptions&lt;POJO_explore_page_item&gt; options = new
  5. FirestoreRecyclerOptions.Builder&lt;POJO_explore_page_item&gt;()
  6. .setQuery(query, POJO_explore_page_item.class).
  7. build();
  8. adapter = new ExplorePageAdapter(options);
  9. RecyclerView recyclerView = getView().findViewById(R.id.explore_recycler);
  10. // recyclerView.setAdapter(null);
  11. // recyclerView.setLayoutManager(null);
  12. // recyclerView.getRecycledViewPool().clear();
  13. recyclerView.setHasFixedSize(true);
  14. recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
  15. recyclerView.setAdapter(adapter);
  16. }

My problem is that whenever I try to rebuild the new recycler view, there is no result unllke the first time the recyler view is built. It is almost as though the recycler view disappeares.

Attempted solutions:

I have tried adding recyclerView.setAdapter(null); andrecyclerView.setLayoutManager(null); before

  1. recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
  2. recyclerView.setAdapter(adapter);

I have also tried rebuilding the recyler view in my OnViewCreated method

  1. public void onViewCreated(View view, Bundle savedInstanceState) {
  2. super.onViewCreated(view, savedInstanceState);
  3. final String id = FirebaseAuth.getInstance().getCurrentUser().getUid();
  4. search_keyword = getView().findViewById(R.id.exp_search);
  5. search_btn = getView().findViewById(R.id.exp_search_btn);
  6. ccp = getView().findViewById(R.id.exp_ccp);
  7. refresh = getView().findViewById(R.id.refresh);
  8. country = ccp.getSelectedCountryName();
  9. //setUpRecyclerView(country);
  10. ///
  11. Log.e(&quot;explore frag&quot;,country);
  12. Query query = Cref.whereEqualTo(&quot;country&quot;, country);
  13. FirestoreRecyclerOptions&lt;POJO_explore_page_item&gt; options = new
  14. FirestoreRecyclerOptions.Builder&lt;POJO_explore_page_item&gt;()
  15. .setQuery(query, POJO_explore_page_item.class).
  16. build();
  17. adapter = new ExplorePageAdapter(options);
  18. final RecyclerView recyclerView = getView().findViewById(R.id.explore_recycler);
  19. recyclerView.setHasFixedSize(true);
  20. recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
  21. recyclerView.setAdapter(adapter);
  22. ///
  23. Log.e(&quot;explore frag&quot;,&quot;1&quot;);
  24. db.collection(&quot;Users&quot;).document(id).collection(&quot;preferences&quot;).document(&quot;event&quot;).get().addOnCompleteListener(new OnCompleteListener&lt;DocumentSnapshot&gt;() {
  25. @Override
  26. public void onComplete(@NonNull Task&lt;DocumentSnapshot&gt; task) {
  27. if (task.isSuccessful()) {
  28. DocumentSnapshot documentSnapshot = task.getResult();
  29. if (documentSnapshot.exists()) {
  30. String anime = documentSnapshot.get(&quot;anime&quot;).toString();
  31. String art = documentSnapshot.get(&quot;art&quot;).toString();
  32. String edu = documentSnapshot.get(&quot;edu&quot;).toString();
  33. String gaming = documentSnapshot.get(&quot;gaming&quot;).toString();
  34. String music = documentSnapshot.get(&quot;music&quot;).toString();
  35. String other = documentSnapshot.get(&quot;other&quot;).toString();
  36. String all = documentSnapshot.get(&quot;all&quot;).toString();
  37. String search_key = search_keyword.getText().toString().trim();
  38. country = ccp.getSelectedCountryName();
  39. if (all.equals(&quot;1&quot;) &amp;&amp; TextUtils.isEmpty(search_key)) {
  40. // setUpRecyclerView(country);
  41. Query query = Cref.whereEqualTo(&quot;country&quot;, country);
  42. FirestoreRecyclerOptions&lt;POJO_explore_page_item&gt; options = new
  43. FirestoreRecyclerOptions.Builder&lt;POJO_explore_page_item&gt;()
  44. .setQuery(query, POJO_explore_page_item.class).
  45. build();
  46. adapter = new ExplorePageAdapter(options);
  47. recyclerView.setAdapter(null);
  48. recyclerView.setLayoutManager(null);
  49. recyclerView.setHasFixedSize(true);
  50. recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
  51. recyclerView.setAdapter(adapter);
  52. Log.e(&quot;explore frag&quot;,&quot;2&quot;);
  53. } else if (all.equals(&quot;1&quot;) &amp;&amp; !(TextUtils.isEmpty(search_key))) {
  54. setUpRecyclerViewWithKeyword(country, search_key);
  55. Log.e(&quot;explore frag&quot;,&quot;3&quot;);
  56. } else if (all.equals(&quot;0&quot;) &amp;&amp; TextUtils.isEmpty(search_key)) {
  57. setUpRecyclerViewWithPreferences(country, anime, art, edu, gaming, music, other);
  58. Log.e(&quot;explore frag&quot;,&quot;4&quot;);
  59. } else {
  60. setUpRecyclerViewWithKeywordAndPreferences(country, search_key, anime, art, edu, gaming, music, other);
  61. Log.e(&quot;explore frag&quot;,&quot;5&quot;);
  62. }
  63. }
  64. }
  65. }
  66. }).addOnFailureListener(new OnFailureListener() {
  67. @Override
  68. public void onFailure(@NonNull Exception e) {
  69. }
  70. });
  71. adapter.setOnItemClickListener(
  72. new ExplorePageAdapter.OnItemClickListener() {
  73. @Override
  74. public void OnItemClick(DocumentSnapshot documentSnapshot, int position) {
  75. String id = documentSnapshot.getId();
  76. Intent intent = new Intent(getActivity(),
  77. event_customer_view_activity.class);
  78. intent.putExtra(&quot;Event_ID&quot;, id);
  79. startActivity(intent);
  80. // getActivity().finish();
  81. }
  82. }
  83. );
  84. }

Neither of these two attempts worked. Any suggestions?

答案1

得分: 1

解决方案

正如 @just_user 的原帖第二条评论所示,我需要在创建新的适配器之前调用 adapter.stopListening()。之后,我可以调用 adapter.startListening()。具体示例如下:

  1. @Override
  2. public void onViewCreated(View view, Bundle savedInstanceState) {
  3. super.onViewCreated(view, savedInstanceState);
  4. final String id = FirebaseAuth.getInstance().getCurrentUser().getUid();
  5. search_keyword = getView().findViewById(R.id.exp_search);
  6. search_btn = getView().findViewById(R.id.exp_search_btn);
  7. ccp = getView().findViewById(R.id.exp_ccp);
  8. refresh = getView().findViewById(R.id.refresh);
  9. country = ccp.getSelectedCountryName();
  10. setUpRecyclerViewInitial(country);
  11. db.collection("Users").document(id).collection("preferences").document("event").get().addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() {
  12. @Override
  13. public void onComplete(@NonNull Task<DocumentSnapshot> task) {
  14. if (task.isSuccessful()) {
  15. DocumentSnapshot documentSnapshot = task.getResult();
  16. if (documentSnapshot.exists()) {
  17. String anime = documentSnapshot.get("anime").toString();
  18. String art = documentSnapshot.get("art").toString();
  19. String edu = documentSnapshot.get("edu").toString();
  20. String gaming = documentSnapshot.get("gaming").toString();
  21. String music = documentSnapshot.get("music").toString();
  22. String other = documentSnapshot.get("other").toString();
  23. String all = documentSnapshot.get("all").toString();
  24. String search_key = search_keyword.getText().toString().trim();
  25. country = ccp.getSelectedCountryName();
  26. adapter.stopListening();
  27. RebuildRecyclerView(country);
  28. }
  29. }
  30. }
  31. }).addOnFailureListener(new OnFailureListener() {
  32. @Override
  33. public void onFailure(@NonNull Exception e) {
  34. }
  35. });
  36. adapter.setOnItemClickListener(
  37. new ExplorePageAdapter.OnItemClickListener() {
  38. @Override
  39. public void OnItemClick(DocumentSnapshot documentSnapshot, int position) {
  40. String id = documentSnapshot.getId();
  41. Intent intent = new Intent(getActivity(),
  42. event_customer_view_activity.class);
  43. intent.putExtra("Event_ID", id);
  44. startActivity(intent);
  45. }
  46. }
  47. );
  48. }
  49. private void setUpRecyclerViewInitial(String country) {
  50. Log.e("explore frag", country);
  51. Query query = Cref.whereEqualTo("country", country).orderBy("count", Query.Direction.ASCENDING);
  52. FirestoreRecyclerOptions<POJO_explore_page_item> options = new
  53. FirestoreRecyclerOptions.Builder<POJO_explore_page_item>()
  54. .setQuery(query, POJO_explore_page_item.class)
  55. .build();
  56. adapter = new ExplorePageAdapter(options);
  57. RecyclerView recyclerView = getView().findViewById(R.id.explore_recycler);
  58. recyclerView.setHasFixedSize(true);
  59. recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
  60. recyclerView.setAdapter(adapter);
  61. }
  62. private void RebuildRecyclerView(String country) {
  63. Log.e("explore frag", country);
  64. Query query = Cref.whereEqualTo("country", country).orderBy("count", Query.Direction.ASCENDING);
  65. FirestoreRecyclerOptions<POJO_explore_page_item> options = new
  66. FirestoreRecyclerOptions.Builder<POJO_explore_page_item>()
  67. .setQuery(query, POJO_explore_page_item.class)
  68. .build();
  69. adapter = new ExplorePageAdapter(options);
  70. adapter.startListening();
  71. RecyclerView recyclerView = getView().findViewById(R.id.explore_recycler);
  72. recyclerView.setHasFixedSize(true);
  73. recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
  74. recyclerView.setAdapter(adapter);
  75. }
  76. @Override
  77. public void onStart() {
  78. super.onStart();
  79. adapter.startListening();
  80. }
  81. public void onResume() {
  82. super.onResume();
  83. adapter.startListening();
  84. }
  85. @Override
  86. public void onDestroy() {
  87. super.onDestroy();
  88. adapter.stopListening();
  89. }
英文:

Solution

As @just_user's second comment on my original post implies, I have to call adapter.stopListening() before I create a new adapter. Afterwards, I can call adapter.startListening().This is illustrated below:

  1. @Override
  2. public void onViewCreated(View view, Bundle savedInstanceState) {
  3. super.onViewCreated(view, savedInstanceState);
  4. final String id = FirebaseAuth.getInstance().getCurrentUser().getUid();
  5. search_keyword = getView().findViewById(R.id.exp_search);
  6. search_btn = getView().findViewById(R.id.exp_search_btn);
  7. ccp = getView().findViewById(R.id.exp_ccp);
  8. refresh = getView().findViewById(R.id.refresh);
  9. country = ccp.getSelectedCountryName();
  10. setUpRecyclerViewInitial(country);
  11. db.collection(&quot;Users&quot;).document(id).collection(&quot;preferences&quot;).document(&quot;event&quot;).get().addOnCompleteListener(new OnCompleteListener&lt;DocumentSnapshot&gt;() {
  12. @Override
  13. public void onComplete(@NonNull Task&lt;DocumentSnapshot&gt; task) {
  14. if (task.isSuccessful()) {
  15. DocumentSnapshot documentSnapshot = task.getResult();
  16. if (documentSnapshot.exists()) {
  17. String anime = documentSnapshot.get(&quot;anime&quot;).toString();
  18. String art = documentSnapshot.get(&quot;art&quot;).toString();
  19. String edu = documentSnapshot.get(&quot;edu&quot;).toString();
  20. String gaming = documentSnapshot.get(&quot;gaming&quot;).toString();
  21. String music = documentSnapshot.get(&quot;music&quot;).toString();
  22. String other = documentSnapshot.get(&quot;other&quot;).toString();
  23. String all = documentSnapshot.get(&quot;all&quot;).toString();
  24. String search_key = search_keyword.getText().toString().trim();
  25. country = ccp.getSelectedCountryName();
  26. adapter.stopListening();
  27. RebuildRecyclerView(country);
  28. }
  29. }
  30. }
  31. }).addOnFailureListener(new OnFailureListener() {
  32. @Override
  33. public void onFailure(@NonNull Exception e) {
  34. }
  35. });
  36. adapter.setOnItemClickListener(
  37. new ExplorePageAdapter.OnItemClickListener() {
  38. @Override
  39. public void OnItemClick(DocumentSnapshot documentSnapshot, int position) {
  40. String id = documentSnapshot.getId();
  41. Intent intent = new Intent(getActivity(),
  42. event_customer_view_activity.class);
  43. intent.putExtra(&quot;Event_ID&quot;, id);
  44. startActivity(intent);
  45. // getActivity().finish();
  46. }
  47. }
  48. );
  49. }
  50. private void setUpRecyclerViewInitial(String country) {
  51. //.whereIn(&quot;type&quot;, Arrays.asList(&quot;Other&quot;))
  52. Log.e(&quot;explore frag&quot;,country);
  53. Query query = Cref.whereEqualTo(&quot;country&quot;, country).orderBy(&quot;count&quot;, Query.Direction.ASCENDING);
  54. FirestoreRecyclerOptions&lt;POJO_explore_page_item&gt; options = new
  55. FirestoreRecyclerOptions.Builder&lt;POJO_explore_page_item&gt;()
  56. .setQuery(query, POJO_explore_page_item.class).
  57. build();
  58. adapter = new ExplorePageAdapter(options);
  59. RecyclerView recyclerView = getView().findViewById(R.id.explore_recycler);
  60. recyclerView.setHasFixedSize(true);
  61. recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
  62. recyclerView.setAdapter(adapter);
  63. }
  64. private void RebuildRecyclerView(String country) {
  65. //.whereIn(&quot;type&quot;, Arrays.asList(&quot;Other&quot;))
  66. Log.e(&quot;explore frag&quot;,country);
  67. Query query = Cref.whereEqualTo(&quot;country&quot;, country).orderBy(&quot;count&quot;, Query.Direction.ASCENDING);
  68. FirestoreRecyclerOptions&lt;POJO_explore_page_item&gt; options = new
  69. FirestoreRecyclerOptions.Builder&lt;POJO_explore_page_item&gt;()
  70. .setQuery(query, POJO_explore_page_item.class).
  71. build();
  72. adapter = new ExplorePageAdapter(options);
  73. adapter.startListening()
  74. RecyclerView recyclerView = getView().findViewById(R.id.explore_recycler);
  75. recyclerView.setHasFixedSize(true);
  76. recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
  77. recyclerView.setAdapter(adapter);
  78. }
  79. @Override
  80. public void onStart() {
  81. super.onStart();
  82. adapter.startListening();
  83. }
  84. public void onResume() {
  85. super.onResume();
  86. adapter.startListening();
  87. }
  88. @Override
  89. public void onDestroy() {
  90. super.onDestroy();
  91. adapter.stopListening();
  92. }

huangapple
  • 本文由 发表于 2020年9月18日 17:35:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/63953152.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定