Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/226.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 注册页面不使用Firebase记录用户数据_Android_Firebase_Nullpointerexception - Fatal编程技术网

Android 注册页面不使用Firebase记录用户数据

Android 注册页面不使用Firebase记录用户数据,android,firebase,nullpointerexception,Android,Firebase,Nullpointerexception,任何帮助都将不胜感激,我已经广泛阅读了这个主题,似乎看不出是什么小问题造成了这种阻碍。也欢迎使用任何其他指针。尝试更改: public class UserProfile { public String user_phone; public String user_email; public String user_name; public UserProfile() { } public UserProfile(String user_pho

任何帮助都将不胜感激,我已经广泛阅读了这个主题,似乎看不出是什么小问题造成了这种阻碍。也欢迎使用任何其他指针。

尝试更改:

public class UserProfile {
    public String user_phone;
    public String user_email;
    public String user_name;

    public UserProfile() {
    }

    public UserProfile(String user_phone, String user_email, String user_name) {
        this.user_phone = user_phone;
        this.user_email = user_email;
        this.user_name = user_name;
    }

    public String getUser_phone() {
        return user_phone;
    }

    public void setUser_phone(String user_phone) {
        this.user_phone = user_phone;
    }

    public String getUser_email() {
        return user_email;
    }

    public void setUser_email(String user_email) {
        this.user_email = user_email;
    }

    public String getUser_name() {
        return user_name;
    }

    public void setUser_name(String user_name) {
        this.user_name = user_name;
    }
}
与:


请添加UserProfile.java和firebase数据库的屏幕截图。这两个都已添加。firebase结构不显示任何uid,但您可以使用它创建附加到侦听器的引用。你没有进入正确的路径。谢谢你,李维,我发现问题出在我的注册码上。您看到可能出现的问题了吗?请将completionlistener添加到您试图在firebase中保存数据的位置,以查看是否出现任何错误。并在此问题中包含任何错误。这停止了崩溃,但数据仍然没有更新。
public class UserProfile {
    public String user_phone;
    public String user_email;
    public String user_name;

    public UserProfile() {
    }

    public UserProfile(String user_phone, String user_email, String user_name) {
        this.user_phone = user_phone;
        this.user_email = user_email;
        this.user_name = user_name;
    }

    public String getUser_phone() {
        return user_phone;
    }

    public void setUser_phone(String user_phone) {
        this.user_phone = user_phone;
    }

    public String getUser_email() {
        return user_email;
    }

    public void setUser_email(String user_email) {
        this.user_email = user_email;
    }

    public String getUser_name() {
        return user_name;
    }

    public void setUser_name(String user_name) {
        this.user_name = user_name;
    }
}
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
    UserProfile userProfile = dataSnapshot.getValue(UserProfile.class);
    assert userProfile != null;
    mProfileName.setText(userProfile.getUser_name());
    mProfileNumber.setText(userProfile.getUser_phone());
    mProfileEmail.setText(userProfile.getUser_email());
}
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
    UserProfile userProfile = dataSnapshot.getValue(UserProfile.class);
    if(userProfile != null){
        mProfileName.setText(userProfile.getUser_name());
        mProfileNumber.setText(userProfile.getUser_phone());
        mProfileEmail.setText(userProfile.getUser_email());
    }
}