单击 AccountFragment 中的按钮后出现此错误
public class AccountFragment extends Fragment {
private static final String TAG = "Profile" ;
FirebaseAuth firebaseAuth;
FirebaseUser currentUser;
DatabaseReference databaseReference;
TextView tv_name, tv_email, tv_gender, tv_home, tv_phone;
private String userID;
Button btn_update;
public AccountFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_account, container, false);
tv_name=view.findViewById(R.id.tv_name);
tv_email=view.findViewById(R.id.tv_email);
tv_gender=view.findViewById(R.id.tv_gender);
tv_home=view.findViewById(R.id.tv_home);
tv_phone=view.findViewById(R.id.tv_phone);
btn_update=view.findViewById(R.id.btn_update);
//ini
firebaseAuth = FirebaseAuth.getInstance();
currentUser = firebaseAuth.getCurrentUser();
userID = currentUser.getUid();
databaseReference = FirebaseDatabase.getInstance().getReference("Customer").child(firebaseAuth.getUid());
//For Retrieve Information
databaseReference.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
Log.d( TAG, "onDataChange :" +dataSnapshot);
Customer cust = dataSnapshot.getValue(Customer.class);
tv_name.setText(cust.getName());
tv_email.setText(cust.getEmail());
tv_gender.setText(cust.getGender());
tv_home.setText(cust.getHome_address());
tv_phone.setText(cust.getTelephone_number());
}
单击按钮后,我收到此错误 2019-09-22 22:20:32
智慧大石
相关分类