I am trying to find way to be able to fire an onclick event on a tab when this tab is the current tab.
I did try this way (among several other) with no success thou
After a lot of thinking about this, the solution ended up being easier than I thought. What I did was just create a new child class that extends TabHost and override the setCurrentTab method like so:
package com.mycompany.Views;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.TabHost;
import android.widget.Toast;
public class ReclickableTabHost extends TabHost {
public ReclickableTabHost(Context context) {
super(context);
}
public ReclickableTabHost(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public void setCurrentTab(int index) {
if (index == getCurrentTab()) {
// FIRE OFF NEW LISTENER
} else {
super.setCurrentTab(index);
}
}
}
To use your new class instead of the typical TabHost just edit your layout xml file with:
Hope this helps...