Hi Android gurus,
I have a ViewFlipper for which I want a listener to fire when the child displayed is changed. I have set an OnFocusChangeListener to the ViewFlipper but it never fires when I flip from child 0 to child 1 or vice-versa. The ViewFlipper contains two RelativeLayouts and I have tried setting OnFocusChangeListeners for those but I get a ClassCastException when I try to set it. Here's my code:
RelativeLayout songsLayout = (RelativeLayout) findViewById(R.id.song_page_layout);
songsLayout.setOnFocusChangeListener(new OnFocusChangeListener() {
public void onFocusChange(View view, boolean hasFocus) {
showPopUp("View " + view.getId() + " now has focus: " + hasFocus);
}
} );
R.is.song_page_layout is one of my RelativeLayouts and showPopUp() is a function I use to show, well, popups.
Does anyone have working code for some sort of trigger that fires when a ViewFlipper changes which child is displayed?