Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here is the sample for you</p> <p>showtab.xml</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="wrap_content" &gt; &lt;/TabWidget&gt; &lt;FrameLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@android:id/tabcontent" &gt; &lt;/FrameLayout&gt; &lt;/LinearLayout&gt; &lt;/TabHost&gt; </code></pre> <p>Below is the code of AfterLoginTabActivity(a tabactivity to be called) </p> <pre><code>public class AfterLoginTabActivity extends TabActivity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.afterloginview); @SuppressWarnings("deprecation") TabHost tabHost =getTabHost(); Intent i = new Intent(AfterLoginTabActivity.this,ProfileClass.class); TabSpec profileSpec = tabHost.newTabSpec("profile").setIndicator("Profile").setContent(i); Intent j = new Intent(AfterLoginTabActivity.this,GroupClass.class); TabSpec groupSpec = tabHost.newTabSpec("group").setIndicator("group").setContent(j); tabHost.addTab(profileSpec); tabHost.addTab(groupSpec); tabHost.setCurrentTab(1); } } </code></pre> <p>Code i used inside my button.setOnClickListener</p> <pre><code> if(msg == "success") { System.out.println("Inside button"); try { Intent intent = new Intent(MainActivity.this,AfterLoginTabActivity.class); startActivity(intent); finish(); } catch (Exception e) { // TODO: handle exception System.out.print("tHIS IS EXCCEPTION" + e); } } </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