java - Getting 'E/AndroidRuntime: Error reporting crash android.os.TransactionTooLargeException' on clicking a Positive button of AlertDialog -
i'm getting error:
e/androidruntime: error reporting crash android.os.transactiontoolargeexception
and too:
java.lang.stackoverflowerror: stack size 8mb
while running below given code:
mauthlistener = new firebaseauth.authstatelistener() { @override public void onauthstatechanged(@nonnull firebaseauth firebaseauth) { final firebaseuser user = firebaseauth.getcurrentuser(); if (user != null) { // user signed in if (isfacebookloggedin()) { if (dialog == null) { final alertdialog.builder builder = new alertdialog.builder(signupactivity.this); layoutinflater inflater = (layoutinflater) getbasecontext().getsystemservice(context.layout_inflater_service); view alertdialogview = inflater.inflate(r.layout.choose_unique_name_dialog, null); uniqueusername = (edittext) alertdialogview.findviewbyid(r.id.uniqueusername); usernamechoosen = (textview) alertdialogview.findviewbyid(r.id.usernamechoosen); usernamewarning = (textview) alertdialogview.findviewbyid(r.id.usernamewarning); usernamechoosen.setvisibility(view.invisible); usernamewarning.setvisibility(view.invisible); builder.settitle("choose unique username"); builder.setview(alertdialogview); builder.setpositivebutton("continue", new dialoginterface.onclicklistener() { @override public void onclick(dialoginterface dialoginterface, int i) { } }); dialog = builder.create(); } dialog.show(); dialog.getbutton(alertdialog.button_positive).setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { wanttoclosedialog = false; //do stuff, possibly set wanttoclosedialog true then... if (uniqueusername.gettext().tostring().isempty()) { toast.maketext(getbasecontext(), "please choose unique username", toast.length_long).show(); wanttoclosedialog = false; } else { mdatabase.child("unique-usernames").addvalueeventlistener(new valueeventlistener() { @override public void ondatachange(datasnapshot datasnapshot) { if (datasnapshot.getvalue() != null) { if (datasnapshot.getvalue().tostring().contains(uniqueusername.gettext().tostring())) { toast.maketext(getbasecontext(), uniqueusername.gettext().tostring() + " taken", toast.length_long).show(); usernamechoosen.settext(uniqueusername.gettext().tostring()); wanttoclosedialog = false; } else { // error happening on execution of code log.d("signedin", "onauthstatechanged:signed_in:" + user.getuid()); mdatabase.child("users").child(user.getuid()).child("name").setvalue(user.getdisplayname()); mdatabase.child("users").child(user.getuid()).child("imageuid").setvalue(user.getphotourl()); mdatabase.child("users").child(user.getuid()).child("uniqueusername").setvalue(uniqueusername.gettext().tostring()); mdatabase.child("users").child(user.getuid()).child("followers").setvalue("00"); mdatabase.child("users").child(user.getuid()).child("following").setvalue("00"); mdatabase.child("unique-usernames").child(ts).setvalue(uniqueusername.gettext().tostring()); intent mainintent = new intent(signupactivity.this, splashactivity.class); mainintent.addflags(intent.flag_activity_new_task); mainintent.addflags(intent.flag_activity_clear_task); startactivity(mainintent); progressdialog.setmessage("signing up..."); progressdialog.setcancelable(false); progressdialog.show(); wanttoclosedialog = true; } } else { log.d("signedin", "onauthstatechanged:signed_in:" + user.getuid()); mdatabase.child("users").child(user.getuid()).child("name").setvalue(user.getdisplayname()); mdatabase.child("users").child(user.getuid()).child("imageuid").setvalue(user.getphotourl()); mdatabase.child("users").child(user.getuid()).child("uniqueusername").setvalue(uniqueusername.gettext().tostring()); mdatabase.child("users").child(user.getuid()).child("followers").setvalue("00"); mdatabase.child("users").child(user.getuid()).child("following").setvalue("00"); mdatabase.child("unique-usernames").child(ts).setvalue(uniqueusername.gettext().tostring()); intent mainintent = new intent(signupactivity.this, splashactivity.class); mainintent.addflags(intent.flag_activity_new_task); mainintent.addflags(intent.flag_activity_clear_task); startactivity(mainintent); progressdialog.setmessage("signing up..."); progressdialog.setcancelable(false); progressdialog.show(); wanttoclosedialog = true; } } @override public void oncancelled(databaseerror databaseerror) { snackbar snackbar = snackbar .make(coordinatorlayout, databaseerror.getmessage(), snackbar.length_long); snackbar.show(); wanttoclosedialog = false; } }); } if(wanttoclosedialog) dialog.dismiss(); //else dialog stays open. make sure have obvious way close dialog if set cancellable false. } }); } else { log.d("signedin", "onauthstatechanged:signed_in:" + user.getuid()); mdatabase.child("users").child(user.getuid()).child("name").setvalue(username.gettext().tostring()); mdatabase.child("users").child(user.getuid()).child("uniqueusername").setvalue(uniqueusername.gettext().tostring()); mdatabase.child("users").child(user.getuid()).child("followers").setvalue("00"); mdatabase.child("users").child(user.getuid()).child("following").setvalue("00"); mdatabase.child("unique-usernames").child(ts).setvalue(uniqueusername.gettext().tostring()); intent mainintent = new intent(signupactivity.this, splashactivity.class); mainintent.addflags(intent.flag_activity_new_task); mainintent.addflags(intent.flag_activity_clear_task); startactivity(mainintent); progressdialog.dismiss(); } } else { // user signed out log.d("signedout", "onauthstatechanged:signed_out"); } // ... } };
i have never seen such error before , that's why have no idea what's happening here.
please let me know causing error!
after looking code @ least 10-12 times, got problem here.
the solution add .tostring()
user.getphotourl()
in line of code: mdatabase.child("users").child(user.getuid()).child("imageuid").setvalue(user.getphotourl());
this answer here gave me bit hint. qbix.
so, has been solved now!
Comments
Post a Comment