Search code examples
androidandroid-recyclerviewandroid-cardviewcardview

Change a CardView's row in a RecyclerView every x sec


Good morning, I am looking for an answer to my problem and I have not found. I want to change a single line of a CardView contained in a RecyclerView every x seconds. Just like Google+ where messages are changed every x seconds. See image

google_plus_1 google_plus_2

Grazie!


Solution

  • you have to do the follow steps.

    1. fetch the data and set it you recyclerview.
    2. wait for x second and again fetch the data. then set it to you adapter and call

    yourAdapter.notifyDataSetChanged();

    1. your list will be refreshed.

    you know na how to set recyclerView.