Android: How to print TextView Title and input in another textView -
i have form , in form have text view title , textedit input(timepicker input) have button in page, after clicking on button want print textview title , textedit input on page(another fragment or text-filed) show result
would please help me in implementation! appreciated sample or hints!
thanks in advance!
1. can utilize toast. , let's textview has id "title", edittext has id "timepicker" , button id "button".
so in oncreate method have:
textview textviewtitle = (textview) findviewbyid(r.id.title); edittext edittexttimepicker = (edittext) findviewbyid(r.id.timepicker); button button= (button) findviewbyid(r.id.button); button.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { toast.maketext(getapplicationcontext(), "title is: " + textviewtitle.gettext().tostring() + " , time picker is: " + edittexttimepicker .gettext().tostring() , toast.length_long).show(); } });
2.
you can open new view(activity) intent , intent add together info want carry new view.
intent = new intent(curentview.this, newview.class); i.putextra("title", <valueoftitlefield>); i.putextra("timepicker", <valueofedittextfield>); startactivity(i);
and when new activity starts can values with.
bundle extras = getintent().getextras(); string title= extras.getstring("title"); string timepciker = extras.getstring("timepicker");
and in new activity can have 2 textview set variables.
i hope understand if not can create simepl app , give source files.
edit: oh asking fragments, reply not much help you, sry.
android android-layout android-fragments android-edittext
No comments:
Post a Comment