slt user slt user - 1 year ago 120
Android Question

How do I edit properties of components?

Let's say I have a button. How would I programmatically edit its properties? I don't want to change the properties using XML code in the layout.

Answer Source

Declare your Button variable:

Button button;

Then write the following in your onCreate() method:

button = (Button) findViewById(<Your buttons ID>);

Please rather do research before asking questions.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download