How to save add button dynamically in android? -
the code should add button dynamically when user needs it.
when users click on addservice
code takes (a name button , value use in intent button) second activity, adds button dynamically in activity name , intent , user can click service.
how save button dynamically added user?
button btn = new button(mainactivity.this); btn.settext(buttonname); layout.addview(btn); btn.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { string phone = servicenum; intent e = new intent(intent.action_dial, uri.fromparts("tel", phone, null)); startactivity(e); } });
include save button in layout, hide before view loads. when user performs action, unhide button. layout should handle automatically you.
Comments
Post a Comment