java - How to create GUI in Android instead of using XML? -


i don't manage xml , java together, can create same gui using java language? how can that, can tell me code simple button? appreciate proper answer.

yes, can.

public class myactivity extends activity {      protected void oncreate(bundle icicle) {          super.oncreate(icicle);           final button button = new button(this);          button.settext("press me!");          setcontentview(button);           button.setonclicklistener(new view.onclicklistener() {              public void onclick(view v) {                  // perform action on click              }          });      }  } 

Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -