# Kindle fire won't display tabs



## mellomel70 (Aug 24, 2012)

I have an Android app that uses tabs for its start menu. The tabs don't display when I port the app to a Kindle Fire. Here's the code:


```
<br />
<?xml version="1.0" encoding="utf-8"?><br />
<ScrollView<br />
xmlns:android="http://schemas.android.com/apk/res/android"<br />
android:layout_height="wrap_content"<br />
android:layout_width="fill_parent"<br />
android:isScrollContainer="true" ><br />
<LinearLayout<br />
android:layout_width="fill_parent"<br />
android:layout_height="wrap_content"<br />
android:orientation="vertical" ><br />
<TabHost<br />
android:id="@+id/tabhost"<br />
android:layout_width="match_parent"<br />
android:layout_height="match_parent" ><br />
<LinearLayout<br />
android:layout_width="match_parent"<br />
android:layout_height="match_parent"<br />
android:orientation="vertical" ><br />
<TabWidget<br />
android:id="@android:id/tabs"<br />
android:layout_width="match_parent"<br />
android:layout_height="wrap_content" ><br />
</TabWidget><br />
<FrameLayout<br />
android:id="@android:id/tabcontent"<br />
android:layout_width="match_parent"<br />
android:layout_height="match_parent" ><br />
<LinearLayout<br />
android:id="@+id/Beginning"<br />
android:layout_width="match_parent"<br />
android:layout_height="match_parent"<br />
android:orientation="vertical" ><br />
</LinearLayout><br />
<LinearLayout<br />
android:id="@+id/Intermediate"<br />
android:layout_width="match_parent"<br />
android:layout_height="match_parent"<br />
android:orientation="vertical" ><br />
</LinearLayout><br />
<LinearLayout<br />
android:id="@+id/Advanced"<br />
android:layout_width="match_parent"<br />
android:layout_height="match_parent"<br />
android:orientation="vertical" ><br />
</LinearLayout><br />
</FrameLayout><br />
</LinearLayout><br />
</TabHost><br />
</LinearLayout><br />
</ScrollView><br />
package com.myproject.project;<br />
import java.io.File;<br />
import java.io.FileOutputStream;<br />
import java.io.IOException;<br />
import java.io.InputStream;<br />
import java.io.OutputStream;<br />
import android.app.Activity;<br />
import android.app.Dialog;<br />
import android.content.Intent;<br />
import android.content.res.AssetManager;<br />
import android.database.Cursor;<br />
import android.graphics.Color;<br />
import android.graphics.Typeface;<br />
import android.os.Bundle;<br />
import android.os.Environment;<br />
import android.view.Gravity;<br />
import android.view.View;<br />
import android.widget.Button;<br />
import android.widget.LinearLayout;<br />
import android.widget.TabHost;<br />
import android.widget.TabHost.TabSpec;<br />
import android.widget.TextView;<br />
import android.widget.Toast;<br />
public class TabsTestActivity extends Activity {<br />
/** Called when the activity is first created. */<br />
public static final String KEY_ROWID = "_id";<br />
public static final String KEY_NAME = "name";<br />
public static final String KEY_LEVEL = "level";<br />
public static final String KEY_CHART = "charted";<br />
public String extStorageDirectory = Environment<br />
.getExternalStorageDirectory().toString();<br />
@Override<br />
public void onCreate(Bundle savedInstanceState) {<br />
super.onCreate(savedInstanceState);<br />
setContentView(R.layout.main);<br />
PopulateDatabase();<br />
CopyVideoFiles();<br />
TabHost tabhost = (TabHost) findViewById(R.id.tabhost);<br />
tabhost.setup();<br />
TabSpec spec_beg = tabhost.newTabSpec("Beginning");<br />
spec_beg.setContent(R.id.Beginning);<br />
TextView txtTabInfo = new TextView(this);<br />
txtTabInfo.setText("JUST STARTING");<br />
Typeface font = Typeface.createFromAsset(getAssets(), "danielbd.ttf");<br />
txtTabInfo.setTypeface(font);<br />
txtTabInfo.setGravity(Gravity.CENTER);<br />
txtTabInfo.setHeight(50);<br />
txtTabInfo.setBackgroundColor(Color.parseColor("#CCDE8A"));<br />
txtTabInfo.setTextColor(Color.parseColor("#262405"));<br />
spec_beg.setIndicator(txtTabInfo);<br />
TabSpec spec_int = tabhost.newTabSpec("Intermediate");<br />
spec_int.setContent(R.id.Intermediate);<br />
txtTabInfo = new TextView(this);<br />
txtTabInfo.setText("GETTING THERE");<br />
txtTabInfo.setTypeface(font);<br />
txtTabInfo.setGravity(Gravity.CENTER);<br />
txtTabInfo.setHeight(50);<br />
txtTabInfo.setBackgroundColor(Color.parseColor("#CCDE8A"));<br />
txtTabInfo.setTextColor(Color.parseColor("#262405"));<br />
spec_int.setIndicator(txtTabInfo);<br />
TabSpec spec_adv = tabhost.newTabSpec("Advanced");<br />
spec_adv.setContent(R.id.Advanced);<br />
txtTabInfo = new TextView(this);<br />
txtTabInfo.setText("REALLY GOOD");<br />
txtTabInfo.setTypeface(font);<br />
txtTabInfo.setGravity(Gravity.CENTER);<br />
txtTabInfo.setHeight(50);<br />
txtTabInfo.setBackgroundColor(Color.parseColor("#CCDE8A"));<br />
txtTabInfo.setTextColor(Color.parseColor("#262405"));<br />
spec_adv.setIndicator(txtTabInfo);<br />
// get data from database, create buttons and name them<br />
SQLData myTable = new SQLData(this);<br />
myTable.open();<br />
Cursor c = myTable.getallData();<br />
int iRow = c.getColumnIndex(KEY_ROWID);<br />
int iName = c.getColumnIndex(KEY_NAME);<br />
int iLevel = c.getColumnIndex(KEY_LEVEL);<br />
// create the buttons<br />
for (c.moveToFirst(); !c.isAfterLast(); c.moveToNext()) {<br />
final String RowNum = c.getString(iRow);<br />
String Name = c.getString(iName);<br />
final String Level = c.getString(iLevel);<br />
Button button = new Button(this);<br />
button.setText(Name);<br />
button.setHeight(20);<br />
button.setTextColor(Color.BLACK);<br />
button.setBackgroundColor(Color.parseColor("#A89E0A"));<br />
button.setHighlightColor(Color.WHITE);<br />
button.setTypeface(font);<br />
button.setOnClickListener(new Button.OnClickListener() {<br />
public void onClick(View v) {<br />
Intent choice = new Intent(getApplicationContext(),<br />
com.myproject.project.myclass.class);<br />
Bundle dataBundle = new Bundle();<br />
dataBundle.putString("RowID", RowNum);<br />
dataBundle.putString("Level", Level);<br />
choice.putExtras(dataBundle);<br />
try {<br />
startActivity(choice);<br />
} catch (Exception e) {<br />
Dialog d = new Dialog(getApplicationContext());<br />
d.setTitle("TabsTestActivity line 131");<br />
TextView tv = new TextView(getApplicationContext());<br />
tv.setText(e.toString());<br />
d.setContentView(tv);<br />
d.show();<br />
} finally {<br />
}<br />
}<br />
});<br />
LinearLayout lbeg = (LinearLayout) findViewById(R.id.Beginning);<br />
LinearLayout lint = (LinearLayout) findViewById(R.id.Intermediate);<br />
LinearLayout ladv = (LinearLayout) findViewById(R.id.Advanced);<br />
if (Level.equals("Beginning"))<br />
lbeg.addView(button);<br />
else if (Level.equals("Intermediate"))<br />
lint.addView(button);<br />
else if (Level.equals("Advanced"))<br />
ladv.addView(button);<br />
}<br />
tabhost.addTab(spec_beg);<br />
tabhost.addTab(spec_int);<br />
tabhost.addTab(spec_adv);<br />
myTable.close();<br />
}<br />
```
Does anyone know why? The tabs and their contents show up fine in the emulator and on my Android phone. Thanks!


----------



## JBirdVegas (Jun 11, 2011)

Look at log cat I'm guessing it didn't dump a stack trace but there may be a clue... kindle may have changed the something. Else ensure all your catch blocks have log notes with the exception that was thrown, cause it sounds like something isn't as built proof as you thought


----------

