片段中使用过的Firebase数据库

时间:2018-07-28 05:05:12

标签: android firebase

public class FragModifyOwnerProfile extends Fragment  {

    private DatabaseReference databaseReference;
    private FirebaseAuth mAuth;
    private  View view;
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment

        view= inflater.inflate(R.layout.fragment_frag_modify_owner_profile,
                container, false);
        mAuth =FirebaseAuth.getInstance().getCurrentUser().getProviderId();
        return view;


    }

}

当我在Firebase中使用Fragment时,我发现语句错误。

1 个答案:

答案 0 :(得分:0)

尝试以下代码,它们可能会为您提供帮助

public class FragModifyOwnerProfile extends Fragment {

        private DatabaseReference databaseReference;
        private FirebaseAuth mAuth;
        private View view;

        @Override
        public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
            return inflater.inflate(R.layout.fragment_frag_modify_owner_profile,
                    container, false);
        }

        @Override
        public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
            super.onViewCreated(view, savedInstanceState);
            this.view=view;
            mAuth = FirebaseAuth.getInstance().getCurrentUser().getProviderId();
        }

    }