• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Custom Method

jjanes

Lurker
So how can I create a custom method. I have several image buttons that I need to change the characteristics of such as an image when it is pushed and when it is not pushed. So when I push one button it changes to a pushed image for that button and ALL other buttons revert to an unpushed image. Currently I have to have this code in every button click method I would LOVE to create one method that I can call from each button click method that way if I have to change anything it is in one place.

I would love to when a button is tapped
call the custom method to revert all buttons to unpushed
then change the button being tapped to pushed

A very common process but I can't figure out how to write the custom method and then call it,,calling it should be simple something like custommethod();

Please let me know if this is possible, hopefully it is.
 
To define a function like that, use this:

Code:
public void customMethod() {
//code here
}

And to call it, simply
Code:
customMethod();
 
Thank you for the response I thought it was that simple and I am very surprised I asked that same question in a few different forums and never got any kind of response I already moved my code around and am testing it now thank you again
 
Back
Top Bottom