Tabs by Intent

by r45k » Sat, 14 Mar 2009 02:11:45 GMT


Sponsored Links
 I can't seem to run the code below without crashing. I followed the
tuts online about tabs exactly and got it working until i changed one
line of code to set a tab's content to a separate class. NOTE: it ran
fine before i added the line that made the content a new class...


public class HelloTabWidget extends TabActivity {
    @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.main);

        final TabHost mTabHost = getTabHost();
          mTabHost.addTab(mTabHost.newTabSpec("tab_test1")
                             .setIndicator("PROFILE").setContent(new
Intent(this, Profile.class)));
                mTabHost.addTab(mTabHost.newTabSpec("tab_test2")
                             .setIndicator("FRIENDS").setContent
(R.id.textview2));
              mTabHost.addTab(mTabHost.newTabSpec("tab_test3")
                              .setIndicator("STATS").setContent
(R.id.textview3));

         mTabHost.setCurrentTab(0);
     }



}






I don't really quite understand whats going wrong when this is
basically code for code from the API demo...
I'm also assuming my error has to do with this line of code:

....setContent(new Intent(this, Profile.class)));.....





here is the profile class:


public class Profile extends ListActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // Use a custom layout file
        setContentView(R.layout.main2);
    }
}






and it's main2 xml:




XML:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android=" http://schemas.android.com/apk/res/android" ;
android:id="@+id/screen"
    android:layout_width="fill_parent"
android:layout_height="fill_parent"
    android:orientation="vertical">
    <LinearLayout
        android:layout_width="fill_parent"
android:layout_height="fill_parent"
        android:orientation="vertical">
     <TextView
           android:layout_width="fill_parent"
     android:layout_height="wrap_content"
          android:text="@string/welcome"/>
    </LinearLayout>
</ScrollView>

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. How does a ContentProvider get destoryed

Hi,

Can you please tell me why a ContentProvider does not have an
onDestory() method? It has a onCreate() method, but not onDestory().

What if I create and register a content oberver for another URI of
another ContentProvider, how can I unregister that?

Thank you.

-- 

2. Droid rooted

Just spotted this.  Apologies if you've seen it

http://alldroid.org/viewtopic.php?f=210&t=567



Pd.

--

3. neighbor cell information yields odd results with 3G

4. Boot log.

5. android hi resolution disable rescale graphics

6. ddms still not recognize my device

7. Error in deploying apk in Android