android - My Activity is crashing my app -
in app activity crashing when trying read text edittext , displaying onto activity.
here code getting text edittext:
intent intent = new intent(this, currenthomework.class); edittext edittext = (edittext) findviewbyid(r.id.homedue); string message = edittext.gettext().tostring(); intent.putextra(extra_message, message);
here code getting text string , putting on textview:
@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); intent intent = getintent(); string message = intent.getstringextra(addnewhomework.extra_message); textview textview = (textview) findviewbyid(r.id.textview99); textview.settext(message);
to clarify shadab's answer, ensure prefix layout id r.layout
, reads:
@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_name_here); intent intent = getintent(); string message = intent.getstringextra(addnewhomework.extra_message); textview textview = (textview) findviewbyid(r.id.textview99); textview.settext(message); }
Comments
Post a Comment