i have created a custom image button; one is play image button and one is pause image button.
i want to switch between play and pause (i.e when the user clicks on the button,it has to change – play to pause or pause to play).
for my requirement, i have referred to this example url
when i execute my program, i am able to display the button, but when i click on the button, i am not able to change the imagebutton (play to pause)
can any one help me?
The example that you are working off of uses two images, the on and the off image. However, it uses these two images to change the look of the button based on whether the button has focus or not.
You want something a little different. You want to change the look of the button whenever the button gets clicked. To do that, you can use this existing method:
To do this, change (or add) some member variables to store the play and pause bitmaps, and then change
navigationClick()to toggle between them:Edit: you also might want to perform the same logic (as above in
navigationClick()) in thetrackwheelClick()andkeyChar()methods, depending on whether your buttons should be clickable by using the trackwheel or enter keys, too. See an example of that here