My activity includes 2 fragments. Fragment 1 in the left contains a ListView, let's call listView1, and fragment 2 in the right contains a GridView. I implemented a onItemSelectedListener to send data to a remote server each time an item in listView1 is selected (users use D-pad to navigate). The listener is as below:
listView1.setOnItemSelectedListener(new OnItemSelectedListener(){
public void onItemSelected(AdapterView<?> parent, View view,
int position, long id){
//send data to sever here
sendData();
}
});
It's ok when I navigate around in the ListView. The sendData() method insides onItemSelected() was called as normal. But the problem is each time I navigate to my GridView and then navigate back to the previous selected item in listView1, the onItemSelected and sendData() method haven't fired off any more. I did a search and found in android reference that the onItemSelected method is invoked only when the newly selected position is different from the previously selected position.
So how can i make onItemSelected fire off even when I navigate back to previous selected item?
Thanks in advances!