TabHost problems moving to Honycomb

178 views Asked by At

working on a db driven tabhost I am running into problem trying to move to Honycomb.

I have something like this:

        Cursor c = db.getAll();
    if ( c.moveToFirst() ) {       
        do {
                 // Log tab name
    Log.d("(Honycomb)", "TabSpec : " + c.getString(2));
                 // Set new tabspec ID
    TabSpec Tab = tabHost.newTabSpec( "tid" + c.getString(1) ) ;
            if( c.getString(2).equals("abc")) {
          Tab.setIndicator( c.getString(2), context.getResources().getDrawable(R.anim.icon1) ) ;
            } else if( c.getString(2).equals("bcd")) {
                Tab.setIndicator( c.getString(2), context.getResources().getDrawable(R.anim.icon2) ) ;
            }
            Intent intent = new Intent() ;
            intent.putExtra( "CATORDER", c.getString(1) );
            intent.setClass(context, Mytab.class) ;
            Tab.setContent( intent ) ;
            tabHost.addTab(Tab) ;

        } while ( c.moveToNext() ) ;

    } else {

             Toast.makeText(context, "There is nothing available.", 
             Toast.LENGTH_LONG).show();

    }
    tabHost.setOnTabChangedListener(OnTabChangeListener);
    tabHost.getTabWidget().setCurrentTab(0);

db.getAll() results in > 2 records comming back from db. In LOGCAT c.getString(2) is seen > 2 times - values as expected, however looking at tabHost on screen I do get all tabs shown BUT only first tab shown with the string (but) without any action posible and after some time return to start of app.

If I switch from Honycomb to 2.2 it shows everything expected?

Also MyTab is having log.d() and from this I only find display from this just the first time only, if running in 3.0 but multiple times (as expected) in 2.2.

Looks like something has changed (or I did something ok for 2.2 but not in 3.0) but so far I could not find what I did wrong. Any idea?

If I would have errors in my LOGCAT telling something I would post this also but they seem not to be there (again switching to 2.2 let this run ok and the c.getString(2) is not only shown > x times but also gives tabs correctly.

Regards, RvE

1

There are 1 answers

0
RvE On

I found problem in my case. It turned out one of my Layout xml views had something fine if running in 2.2 but not ok in 3.0. Took some time to find this because I never had some error pointing to this at all. So, if one is having simular issues try to look at your layout xml to see if there is something in causing unwanted behavior inside your app.