android - Displaying A textView -
i want display text displayed when button clicked in new page thing showing default "textview"
this page before display. once click 1 button takes them next page showing them there results
public class option1 extends activity implements onclicklistener{
@override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); this.setcontentview(r.layout.option1); button butn1 = (button) findviewbyid(r.id.button1); butn1.setonclicklistener(this); } @override public void onclick(view v) { intent intent = new intent(this,display.class); intent.putextra("option", "choice1"); startactivityforresult(intent, 1); this.startactivity(intent); } }
once press button on previous page want show picked depending on button clicked not showing new text in textview area
public class display extends activity implements onclicklistener{ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); this.setcontentview(r.layout.display); //it works if have part //textview tv = (textview) findviewbyid(r.id.textview1); //tv.settext("exterior" + "\noption1"); } @override public void onclick(view v) { intent intent = getintent(); string msg = intent.getstringextra("option"); if (msg.contentequals("choice1")){ textview tv = (textview) findviewbyid(r.id.textview1); tv.settext("exterior" + "\noption1"); } else if (msg.contentequals("choice2")){ } } }
you should have textview invisible in xml
if (msg.contentequals("choice1")){ textview tv = (textview) findviewbyid(r.id.textview1); tv.setvisibility(view.visible); tv.settext("exterior" + "\noption1 "); }
Comments
Post a Comment