Note that there are some explanatory texts on larger screens.

plurals
  1. POTab activity view not changing
    primarykey
    data
    text
    <p>In my app there are 3 tabs in that,third tab having 3 different buttons with its corresponding activities(i used activity group for that). while running the app all tab and their corresponding activities shows fine.my problem is in third tab.in that tab i have 3 buttons ex. A B and c by default its loads button A now i am changing to button B by clicking that button B.</p> <p>Now if i click the third tab it has to show the Button A again but it does not changing.</p> <p>Here is my complete code</p> <pre><code>@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.groupinion_tabs); tabHost = (TabHost) findViewById(android.R.id.tabhost); setTabs(); } /* * control go when specipic tab is pressed */ private void setTabs() { //call the addTab method to add tabs addTab("Questions", R.drawable.tab_questions, Gropinion_Questions.class); addTab("Ask", R.drawable.tab_ask, Groupinion_Ask.class); addTab("My Stuff", R.drawable.tab_stuff, Groupinion_Mystuff.class); //addTab("Friends", R.drawable.tab_friends, Groupinion_Find_Friends.class); } // set the tab name and symbols to the tab private void addTab(String labelId, int drawableId, Class&lt;?&gt; c) { tabHost = getTabHost(); String strid=""; for(int i=0;i&lt;=2;i++) { if(i==0){ strid="one";} if(i==1){ strid="two";} if(i==2){ strid="three";} } //tabHost.setCurrentTab(Singleton.tabID); tabHost.setCurrentTab(0); Intent intent = new Intent(this, c); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); TabHost.TabSpec spec = tabHost.newTabSpec("tab" + labelId); View tabIndicator = LayoutInflater.from(this).inflate( R.layout.groupnion_tab_indicator, getTabWidget(), false); TextView title = (TextView) tabIndicator.findViewById(R.id.title); title.setText(labelId); ImageView icon = (ImageView) tabIndicator.findViewById(R.id.icon); icon.setImageResource(drawableId); spec.setIndicator(tabIndicator); spec.setContent(intent); tabHost.addTab(spec); if (tabHost.getCurrentTab() == 0) { getTabWidget().getChildAt(0).setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { startActivity(getIntent()); } }); } if (tabHost.getCurrentTab() == 1) { getTabWidget().getChildAt(1).setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { startActivity(getIntent()); } }); } if (tabHost.getCurrentTab() == 2) { getTabWidget().getChildAt(2).setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent i=new Intent().setClass(getApplicationContext(), Groupinion_Mystuff.class); navigateUpTo(i); startActivity(i); //startActivity(getIntent()); } }); } //call tabchanged listener when user click another tab tabHost.setOnTabChangedListener(new OnTabChangeListener() { @Override public void onTabChanged(String tabId) { // TODO Auto-generated method stub if (tabId.equals("one")) { getTabWidget().getChildAt(0).setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { startActivity(getIntent()); } }); } else if (tabId.equals("two")) { getTabWidget().getChildAt(1).setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { startActivity(getIntent()); } }); }else if (tabId.equals("three")) { getTabWidget().getChildAt(2).setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { startActivity(getIntent()); } }); } } } }); } </code></pre> <p>}</p> <p>Thanks in Advance</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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