Here is a scenario, for example, I have an Image Button named as a_1
in android. I want to store that button name in a variable i.e. variable = a_1
so that I can pass it to a method and use it in that method i.e. variable.set_Image_Resource(...)
. Is this possible? If so, your ideas will be appreciated. If not, any alternate solution will be appreciated.
I have searched a lot on many platforms but nothing useful found except storing button-text in a variable.
The reason of such question is, I have 64 Image-Buttons in my application and there is a scenario where 32-buttons have a switch statement on them. If I go to implement all the 64-buttons with 32 switches and each switch has 32 cases, that will be a crazy approach. So, what I want to do is, I want to make just one method which have just one switch, in which I pass the button and instead of using the button qualifier i.e. button_name.something()
I can use that parameter i.e. parameter.something()
.
I know there are many other ways to implement this problem but I am supposed to solve this problem in this way.