Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Please specify yours question in a more descriptive way any way what i understand on the basis of that please look on the code</p> <pre><code>intent = new Intent(this, HomeGroup.class); View tab1 = _inflater.inflate(R.layout.custom_tab_1,null); homeTab.setTag("Tab1"); spec = tabHost.newTabSpec("Tab1").setIndicator(tab1).setContent(intent); tabHost.addTab(spec); View tab2 = _inflater.inflate(R.layout.custom_tab_2,null); homeTab.setTag("Tab2"); spec = tabHost.newTabSpec("Tab2").setIndicator(tab2).setContent(intent); tabHost.addTab(spec); View tab3 = _inflater.inflate(R.layout.custom_tab_3,null); homeTab.setTag("Tab3"); spec = tabHost.newTabSpec("Tab3").setIndicator(tab3).setContent(intent); tabHost.addTab(spec); tabHost.setOnTabChangedListener(this); //click on seleccted tab int numberOfTabs = tabHost.getTabWidget().getChildCount(); for(int t=0; t&lt;numberOfTabs; t++){ tabHost.getTabWidget().getChildAt(t).setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if(event.getAction()==MotionEvent.ACTION_UP){ String currentSelectedTag = MainTab.this.getTabHost().getCurrentTabTag(); String currentTag = (String)v.getTag(); Log.d(this.getClass().getSimpleName(), "currentSelectedTag: " + currentSelectedTag + " currentTag: " + currentTag); if(currentSelectedTag.equalsIgnoreCase(currentTag)){ MainTab.this.getTabHost().setCurrentTabByTag(currentTag); String newSelectedTabTag = MainTab.this.getTabHost().getCurrentTabTag(); if(newSelectedTabTag.toLowerCase().indexOf("tab1")!=-1){ //do smthg }else if(newSelectedTabTag.toLowerCase().indexOf("tab1")!=-1){ //do smthg }else if(newSelectedTabTag.toLowerCase().indexOf("tab3")!=-1){ //do smthg } return true; } } return false; } }); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload