java - Creating a button dynamically with a user inputted title from different activity -
i'm trying learn little android programming on side, still beginner, appreciated, i'm sure isn't hard experience.
what want able load activity, "add button" button.
when add button clicked page links 3 user inputted strings (say str1, str2, str3). want able click button on second activity , have screen link original activity, new button added displaying "str1 str2 str3" , "add button" button underneath new one.
i have managed first part , have created of fields , button on 2nd activity, don't know how go creating button on first activity dynamically , string desired.
thank in advance!!
in layout add button
<button android:id="@+id/button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="..."/>
and in java try this:
button mbutton = (button)findviewbyid(r.id.button); mbutton.settextsize(str1+str2+str3);
and button click event:
mbutton.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { //do want here } });
Comments
Post a Comment