daily pastebin goal
71%
SHARE
TWEET

Untitled

a guest Mar 13th, 2018 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.example.hinkeong.singtraffic_onemap;
  2.  
  3. import android.support.constraint.solver.widgets.Snapshot;
  4. import android.widget.Toast;
  5.  
  6. import com.google.firebase.auth.FirebaseAuth;
  7. import com.google.firebase.auth.FirebaseUser;
  8. import com.google.firebase.database.DataSnapshot;
  9. import com.google.firebase.database.DatabaseError;
  10. import com.google.firebase.database.DatabaseReference;
  11. import com.google.firebase.database.FirebaseDatabase;
  12. import com.google.firebase.database.ValueEventListener;
  13.  
  14. /**
  15.  * Created by Nelson on 25/2/2018.
  16.  */
  17.  
  18. public class getData{
  19. public static String DB;
  20. public static String Username;
  21. public static String Email;
  22. public static String uid;
  23. public static String test;
  24.     public getData(String Name)
  25.     {
  26.         Email = LoginMain.name;  // String name from LoginMain
  27.         test = "1";
  28.         //FirebaseUser currentFireUser = FirebaseAuth.getInstance().getCurrentUser();
  29.         //uid = currentFireUser.getUid();
  30.  
  31.         if(LoginMain.logged)
  32.         {
  33.             FirebaseDatabase database = FirebaseDatabase.getInstance();
  34.  
  35.             DatabaseReference myRef = database.getReference("Users");
  36.  
  37.             myRef.addValueEventListener(new ValueEventListener() {
  38.                 @Override
  39.                 public void onDataChange(DataSnapshot dataSnapshot) {
  40.                         DB = dataSnapshot.child("Users").child("JwIT1zVZsBZkfpcaxMc9aVDyLNe2").child("DB").getValue(String.class);
  41.                         Username = dataSnapshot.child("Users").child(uid).child("Name").getValue(String.class);
  42.                 }
  43.  
  44.                 @Override
  45.                 public void onCancelled(DatabaseError databaseError) {
  46.  
  47.                 }
  48.             });
  49.         }
  50.  
  51.     }
  52. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top