tags:

views:

260

answers:

0

Hi,

I was trying the TabLayout Tutorial from official developers site. I didnt copy paste it as such and some minor changes and corrections to typos in the tut.

package com.org.example;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;

public class HalloTabLayout extends TabActivity {



    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        Intent intent;
     TabHost tabhost = getTabHost();
     TabHost.TabSpec tabspec;
     Resources res = getResources();

        //For the Family Tab

        //Intent

        intent = new Intent().setClass(this, FamilyLayout.class);

        //Setting the tab

        tabspec = tabhost.newTabSpec("family").setIndicator("Family", res.getDrawable(R.drawable.tab_spec)).setContent(intent);

        tabhost.addTab(tabspec); 

      //Default tab to display

        tabhost.setCurrentTabByTag("family");
    }

}

As a first step and make sure the code is right, I wanted to have a Single tab displayed.

I added the FamilyLayout activity to AndroidManifest.xml file and also made changes suggested in here. http://stackoverflow.com/questions/2209406/issues-with-android-tabhost-example

But the application keeps crashing on run time in the emulator. Any help would be much appreciated.

[Solution:] I used a .jpeg of high resolution and size(3.5mb) which was cause of trouble. I changed it into a lower resolution, size pic and it worked without troubles. I found out via trial and error that images beyond 1600*900 will make apps crash. Not an exact statistic, but it may help.