android - Passing data with intents -
why won't work? trying pass editable string 1 activity another. cannot work. string passed through intent have pre defined? if so, how can pass editable string?
@override public void onclick(view v) { // todo auto-generated method stub textout.settext(textin.gettext()); intent intent = new intent(tutorialone.this,mainactivity.class); intent.putextra("text", textin.gettext()); startactivity(intent); } public class mainactivity extends activity { textview gettext; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); gettext = (textview) findviewbyid(r.id.textview1); intent intent = getintent(); intent.getextras().getstring("text"); string s = intent.getstringextra("text"); gettext.settext(s); gettext.settextcolor(color.white); }
use instead of this.
@override public void onclick(view v) { // todo auto-generated method stub textout.settext(string.valueof(textin.gettext())); intent intent = new intent(tutorialone.this,mainactivity.class); intent.putextra("text", string.valueof(textin.gettext())); startactivity(intent); }
instead of this.
@override public void onclick(view v) { // todo auto-generated method stub textout.settext(textin.gettext()); intent intent = new intent(tutorialone.this,mainactivity.class); intent.putextra("text", textin.gettext()); startactivity(intent); }
Comments
Post a Comment