I have 2 Arraylists. One fetches SQLite data and one fetches Firebase Data
What i want to do is display the sqlite Data first and then below that the Firebase data... My SQLite data is mostly old data and firebase data is new. So i want the new data to be showed first and then if i swipe up the old one. Can i add 2 lists to same recyclerviews as both fetches different types of data
SQLite
while (csr.moveToNext()) {
String mA= csr.getString(csr.getColumnIndex(A));
String mB = csr.getString(csr.getColumnIndex(B));
String mC= csr.getString(csr.getColumnIndex(C));
String mD= csr.getString(csr.getColumnIndex(D));
String mE= csr.getString(csr.getColumnIndex(E));
String mF= csr.getString(csr.getColumnIndex(F));
list.add(new SQLiteHelper(mA, mV, mC, mD, mE, mF));
}
Firebase
Helper help= dataSnapshot.getValue(Helper.class);
List.add(help);
Arraylist 1 = list (Old data)
Arraylist 2 = List (New Data)
Can someone help me out please
You can just Create an Arraylist for the Adapter and then add the data you want to display first first and add the data you want to display below after that.
List<Helper> sqlite = ...
List<Helper> firebase = ...
List<Helper> helpers = new ArrayList<>();
helpers.addAll(sqlite);
helpers.addAll(firebase);
//TODO pass list to the adapter
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.