slt user slt user - 6 months ago 48
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.


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.