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

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -