Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. public void addGroupAdapter() {
  2. Firebase jsonurl = new Firebase("firebase url");
  3. jsonurl.addValueEventListener(new ValueEventListener() {
  4. @Override
  5. public void onDataChange(DataSnapshot dataSnapshot) {
  6. try {
  7. Log.i("Response Array fire",new JSONArray(dataSnapshot.getValue(String.class)).toString());
  8. if (!adapted){
  9. chatLists.setAdapter(new ContactListAdapter(getContext(),dataSnapshot));
  10. adapted = true;
  11. }else {
  12. Log.i("update",dataSnapshot.getValue(String.class));
  13. new ContactListAdapter(getContext(),dataSnapshot).notifyDataSetChanged();
  14.  
  15. }
  16.  
  17. } catch (JSONException e) {
  18. e.printStackTrace();
  19. }
  20. }
  21.  
  22. @Override
  23. public void onCancelled(FirebaseError firebaseError) {
  24.  
  25. }
  26. });
  27.  
  28. new ContactListAdapter(getContext(),dataSnapshot).notifyDataSetChanged();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement