Skip to content Skip to sidebar Skip to footer

Longclick In Tabs

Is there a way we can add setOnLongClickListener in Tabs?? Or is there any other way where i can call one activity when clicked on a tab and a different activity when long clicked

Solution 1:

Tested and verified where "0" is the index of the tab to be long clicked:

tabHost.getTabWidget().getChildAt(0).setOnLongClickListener(new OnLongClickListener() {
    public boolean onLongClick(View v) {
        Toast.makeText(getApplicationContext(), "long click", 1).show();
        return true;
    }
});

Post a Comment for "Longclick In Tabs"