How to display records from a Firebase database using HashMap with Android?

ساخت وبلاگ

Vote count: 0

I am developing an app in which the users can have multiple lists. My Firebase database looks like this:

enter image description here

The model that i use is this:

public class UserModel { private String userId; private String userName; private String userEmail; private HashMap lists; public UserModel() {} public void setUserId(String userId) {this.userId = userId;} public String getUserId() {return userId;} public void setUserName(String userName) {this.userName = userName;} public String getUserName() {return userName;} public void setUserEmail(String userEmail) {this.userEmail = userEmail;} public String getUserEmail() {return userEmail;} public void setLists(HashMap lists) {this.lists = lists;} public HashMap getLists() {return lists;}
},>,>,>

For displaying the lists, i use a FirebaseListAdapter and a ListView. If i use the code like this:

DatabaseReference listsRef = usersRef.child(userId).child("lists");
adapter = new FirebaseListAdapter>(MainActivity.this, Map.class, android.R.layout.simple_list_item_1, listsRef) { @Override protected void populateView(View v, Map map, int position) { for (Map.Entry entry : map.entrySet()) { Log.d(TAG, entry.getKey() + "/" + entry.getValue()); } } ListView listView = (ListView) findViewById(R.id.list_view); listView.setAdapter(adapter);
} ,>,>

I get this error: Error:(221, 31) error: no suitable constructor found for FirebaseListAdapter

All i want to do, is to display the key and the value using HashMap. Where am i wrong?

Thanks in advance!

asked 1 min ago

back soft...
ما را در سایت back soft دنبال می کنید

برچسب : نویسنده : استخدام کار backsoft بازدید : 567 تاريخ : پنجشنبه 26 اسفند 1395 ساعت: 7:06