I need to be able to supply a dynamic behavior for the buttons in my project. So far the closest I've gotten is using an XML like this:\[code\]<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android"><item android:state_pressed="true" android:drawable="@drawable/mainmenu_button_pressed" /> <item android:state_enabled="false" android:drawable="@drawable/mainmenu_button_disabled" /> <item android:drawable="@drawable/mainmenu_button" /> </selector>\[/code\]This does exactly the trick, but as stated on the question's topic my project needs this to be dynamic, I'll explain what I mean...This application has an intro menu and the several options have different images on them. Depending on a user-made choice at runtime (before this menu) I need to be able to supply a different set of images to the buttons. The ideal way to do this would be:\[code\]<item android:state_pressed="true" android:drawable="%MAINMENU_BUTTON_PRESSED%" />\[/code\]So I could just set %MAINMENU_BUTTON_PRESSED and it would use set A (A_mainpressed.png) or B (B_mainpressed.png) without requiring extra coding.I'm aware the probably proper way to do this would be using the OnClick function and doing everything programmatically. Considering, however, the ammount of manual work that implies on my project I wanted to first make sure there was really no way of creating a dynamic XML and supplying it to the button so it would work just like that (AFAIK all ressources are compiled and therefore cannot be modified at runtime, also, an XML file on the assets folder won't work because those are not compiled and hence do not generate an ID that I can supply).Is there any way to achieve this behavior or should I just swallow it and stick with the OnClick method? Thanks