Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- auth = FirebaseAuth.getInstance();
- if (auth.getCurrentUser() != null) {
- if(loginflag.equals("0")){
- startActivity(new Intent(LoginActivity.this, HomeUsers.class));
- finish();
- }
- else if (loginflag.equals("1")) {
- startActivity(new Intent(LoginActivity.this, HomeEducator.class));
- finish();
- }
- }
- }
- private void loginControl() {
- FirebaseUser user = auth.getCurrentUser();
- String id = user.getUid();
- DatabaseReference FirebaseRef = FirebaseDatabase.getInstance().getReference().child("users").child(id);
- FirebaseRef.addValueEventListener(new ValueEventListener() {
- @Override
- public void onDataChange(DataSnapshot snapshot) {
- if(snapshot.exists()){
- loginflag = snapshot.child("flag").getValue().toString();
- }
- }
- @Override
- public void onCancelled(DatabaseError databaseError) {
- }
- });
- }
Add Comment
Please, Sign In to add comment