How to detect onClick
event on the tab when i extend SherlockFragmentActivity
- I mean say i click Rating Tab ....
Log msg Rating tab is clicked = 1
- when i click rating tab again ....
Log msg Rating tab is clicked = 2
Note:: I checked several solutions on stackoverflow but none of them answer when i use sherlockFragmentActivity
MainActivitySherlock.java
public class MainActivitySherlock extends SherlockFragmentActivity {
// Declare Variables
private FragmentTabHost mTabHost;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Set the view from main_sorting.xml
setContentView(R.layout.main_sorting);
// Locate android.R.id.tabhost in main_sorting.xml
mTabHost = (FragmentTabHost) findViewById(android.R.id.tabhost);
// Create the tabs in main_sorting.xml
mTabHost.setup(this, getSupportFragmentManager(), R.id.tabcontent);
// Create Rating
mTabHost.addTab(mTabHost.newTabSpec("rating").setIndicator("Rating"),
FragmentRating.class, null);
// Create Price
mTabHost.addTab(mTabHost.newTabSpec("Price").setIndicator("Price"),
FragmentPrice.class, null);
// Create Distance
mTabHost.addTab(mTabHost.newTabSpec("Distance").setIndicator("Distance"),
FragmentDistance.class, null);
}
//Split ActionBar Buttons
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater menuInflater = getSupportMenuInflater();
menuInflater.inflate(R.menu.actionbar_sort_menu, menu);
return super.onCreateOptionsMenu(menu);
}
}
How to achieve this !