Browsed by
Tag: firebase list data read

Firebase for android : Read list of data from database and show on recyclerview

Firebase for android : Read list of data from database and show on recyclerview

Part -1 : Take that we have some data field on child node named “user” . We will first retrieve all data and then we will show it on recyclerview. , public class UserListActivity extends AppCompatActivity { private DatabaseReference mDatabase; ArrayList<User> userArrayList; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_user_list); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); mDatabase = FirebaseDatabase.getInstance().getReference(); mDatabase.child(“user”).addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot snapshot) { Toast.makeText(UserListActivity.this, snapshot.toString(), Toast.LENGTH_SHORT).show(); @Override public void onCancelled(DatabaseError databaseError) { System.out.print(databaseError.toString()); } });…

Read More Read More