0

What I want to do is to add data from the multiple data sources into single RecyclerView but I don't know how to do it in Android Studio, can someone help me to understand this?

aminography
  • 21,986
  • 13
  • 70
  • 74
  • 2
    Hi Farrukh, the best way to get an answer to your question is to also post the code that is troubling you. Unless you've first tried solving it for yourself, you might not receive much help. If you've tried, post it here. – Ivan86 Nov 19 '19 at 03:07
  • Dear, I just try to learn that is it possible to publish data from two different data sources into into single recycler view and if possible then how ? – Farrukh Ehsan Nov 19 '19 at 03:15
  • I suggest looking into the topics: `recyclerview`, `recyclerview adapter` and `local/remote repositories`, I believe that could help you. – Ivan86 Nov 19 '19 at 03:25

2 Answers2

0

Farrukh Ehsan,

You haven't mention how far you try.

First of all, yes. It is possible.

There are some question:

  1. How data come local or form server?
  2. Is it come in same time or different?

Assume that your data will come different time, that means your data will update after binding data to recyclerview adapter and it is server data.

so, you have to modify data object and marge data on update your data then re-bind data on adapter and re-set to recycleview.

if your data come once then marge data that you got from different data source the bind to adapter and set to recycleview.

Md. Enamul Haque
  • 926
  • 8
  • 14
0

Make a list of type Object and add all the models that you want to have in Recyclerview. Now in Recyclerview's adapter make separate ViewHolder class for each type of data sources. It somewhat like showing Admob ads in Recyclerview items.

abhi
  • 961
  • 9
  • 13