android - how can I edit "user_mobile" value -
i want edit "user_mobile" , "user_blood".
i have tried code.
mauth = firebaseauth.getinstance(); string online_user_id = mauth.getcurrentuser().getuid(); getuserdatareference = firebasedatabase.getinstance().getreference().child("users").child(online_user_id); getuserdatareference.addvalueeventlistener(new valueeventlistener() { @override public void ondatachange(datasnapshot datasnapshot) { //datasnapshot.get string name = datasnapshot.child("user_name").getvalue().tostring(); string status = datasnapshot.child("user_status").getvalue().tostring(); string image = datasnapshot.child("user_image").getvalue().tostring(); mobile = datasnapshot.child("user_mobile").getvalue().tostring(); string thumb_image = datasnapshot.child("user_thumb_image").getvalue().tostring(); settingdisplayname.settext(name); settingdisplaystatus.settext(status); if (!image.equals("default_profile")) { picasso.with(settingactivity.this).load(image).placeholder(r.drawable.default_profile).into(settingsdisplayimage); } } @override public void oncancelled(databaseerror databaseerror) { } });
here error.
fatal exception: main process: com.logictex.bloodbank, pid: 2486 java.lang.nullpointerexception: attempt invoke virtual method 'java.lang.string java.lang.object.tostring()' on null object reference @ com.logictex.bloodbank.settingactivity$1.ondatachange(settingactivity.java:77) @ com.google.android.gms.internal.zzbmz.zza(unknown source) @ com.google.android.gms.internal.zzbnz.zzyj(unknown source) @ com.google.android.gms.internal.zzboc$1.run(unknown source) @ android.os.handler.handlecallback(handler.java:739) @ android.os.handler.dispatchmessage(handler.java:95) @ android.os.looper.loop(looper.java:135) @ android.app.activitythread.main(activitythread.java:5254) @ java.lang.reflect.method.invoke(native method) @ java.lang.reflect.method.invoke(method.java:372) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:903) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:698)
databasereference xyz= firebasedatabase.getinstance().getreference().child("users").child(online_user_id).child("user_mobile"); xyz.setvalue("set_desired vaule");
do same use_blood
Comments
Post a Comment