[android-developers] Re: add tab cause exception

2009-03-06 Thread Francisco

Hey did you find out what was wrong? im having a very similar issue.

On Feb 9, 9:04 am, AndroidGeek binli...@gmail.com wrote:
 And also found in my control java file override onCreate(Bundle
 saveInstanceState) method,
 super.onCreate(savedInstanceState) cause error, because
 saveInstanceState = null;

 Thanks

 On Feb 9, 11:57 am, AndroidGeek binli...@gmail.com wrote:



  Hey,
  I tried to add composite control to tabHost, I followed android
  example Tab3.java to do that.
  I created a new activity with listview, textview as following:

  ?xml version=1.0 encoding=utf-8?
  ScrollView xmlns:android=http://schemas.android.com/apk/res/android;
      android:orientation=vertical
      android:layout_width=fill_parent
      android:layout_height=fill_parent
      LinearLayout android:id=@+id/goal
                  android:layout_width=fill_parent
  android:layout_height=fill_parent
                  android:background=#fff49501 
  android:orientation=vertical
                  xmlns:android=http://schemas.android.com/apk/res/android;
                  ListView android:id=@+id/goallist
                          android:layout_width=fill_parent 
  android:layout_height=150px
                  /ListView
                  TextView android:id=@+id/healthTipLabel
                          android:layout_width=fill_parent
                          android:layout_height=wrap_content
  android:layout_marginTop=20px
                          android:text=Health Tips android:textSize=20sp
                          android:typeface=sans android:textStyle=bold
                          android:layout_gravity=center_horizontal
                  /TextView
                  ListView android:id=@+id/healthtiplist
                          android:layout_width=fill_parent 
  android:layout_height=200px
                          android:layout_marginTop=20px
                  /ListView
                  /LinearLayout
  /ScrollView

  and my java:

  public class GoalView extends Activity {
  protected void onCreate(Bundle savedInstanceState) {
                  super.onCreate(savedInstanceState);
                  setContentView(R.layout.goalcontrol);
     }

  }

  manifest file:

  activity android:name=.views.GoalView
                          intent-filter
                                  action 
  android:name=android.intent.action.MAIN/action
                          /intent-filter
                  /activity

  Tab.java:

  public class MyActivity extends TabActivity  {

          DatabaseAdapter da = null;

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

                  ArrayListString script = loadCreateScript();
                  da = (DatabaseAdapter.getInstance(this, script));

                  final TabHost tabHost = getTabHost();
                  
  tabHost.addTab(tabHost.newTabSpec(Goals).setIndicator(Goals,
                                  
  getResources().getDrawable(R.drawable.goal_icon)).setContent(new
  Intent(this, GoalView.class)));

  But when I run my app, I got runtime exception:
 InvocationTargetException(id=xxx)
  Unable to start activity ComponentInfo{com.mycompany/
  com.mycomapny.MyActivity}: java.lang.RuntimeException: Unable to
  instantiate activity ComponentInfo{com.mycompany/
  com.mycompany.views.GoalView}: java.lang.InstantiationException:
  com.mycompany.views.GoalView

  Please help!!!
  Thanks in advance.- Hide quoted text -

 - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: add tab cause exception

2009-02-09 Thread AndroidGeek

And also found in my control java file override onCreate(Bundle
saveInstanceState) method,
super.onCreate(savedInstanceState) cause error, because
saveInstanceState = null;

Thanks

On Feb 9, 11:57 am, AndroidGeek binli...@gmail.com wrote:
 Hey,
 I tried to add composite control to tabHost, I followed android
 example Tab3.java to do that.
 I created a new activity with listview, textview as following:

 ?xml version=1.0 encoding=utf-8?
 ScrollView xmlns:android=http://schemas.android.com/apk/res/android;
     android:orientation=vertical
     android:layout_width=fill_parent
     android:layout_height=fill_parent
     LinearLayout android:id=@+id/goal
                 android:layout_width=fill_parent
 android:layout_height=fill_parent
                 android:background=#fff49501 android:orientation=vertical
                 xmlns:android=http://schemas.android.com/apk/res/android;
                 ListView android:id=@+id/goallist
                         android:layout_width=fill_parent 
 android:layout_height=150px
                 /ListView
                 TextView android:id=@+id/healthTipLabel
                         android:layout_width=fill_parent
                         android:layout_height=wrap_content
 android:layout_marginTop=20px
                         android:text=Health Tips android:textSize=20sp
                         android:typeface=sans android:textStyle=bold
                         android:layout_gravity=center_horizontal
                 /TextView
                 ListView android:id=@+id/healthtiplist
                         android:layout_width=fill_parent 
 android:layout_height=200px
                         android:layout_marginTop=20px
                 /ListView
                 /LinearLayout
 /ScrollView

 and my java:

 public class GoalView extends Activity {
 protected void onCreate(Bundle savedInstanceState) {
                 super.onCreate(savedInstanceState);
                 setContentView(R.layout.goalcontrol);
    }

 }

 manifest file:

 activity android:name=.views.GoalView
                         intent-filter
                                 action 
 android:name=android.intent.action.MAIN/action
                         /intent-filter
                 /activity

 Tab.java:

 public class MyActivity extends TabActivity  {

         DatabaseAdapter da = null;

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

                 ArrayListString script = loadCreateScript();
                 da = (DatabaseAdapter.getInstance(this, script));

                 final TabHost tabHost = getTabHost();
                 
 tabHost.addTab(tabHost.newTabSpec(Goals).setIndicator(Goals,
                                 
 getResources().getDrawable(R.drawable.goal_icon)).setContent(new
 Intent(this, GoalView.class)));

 But when I run my app, I got runtime exception:
 InvocationTargetException (id=xxx)
 Unable to start activity ComponentInfo{com.mycompany/
 com.mycomapny.MyActivity}: java.lang.RuntimeException: Unable to
 instantiate activity ComponentInfo{com.mycompany/
 com.mycompany.views.GoalView}: java.lang.InstantiationException:
 com.mycompany.views.GoalView

 Please help!!!
 Thanks in advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---