add tab cause exception

by AndroidGeek » Tue, 10 Feb 2009 00:58:05 GMT


Sponsored Links
 ey,
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);

ArrayList<String> 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=xxxxxxxxxxx)
Unable to start activity ComponentInfo{com.mycompany/
com.mycomapny.MyActivity}: java.lang.RuntimeException: Unable t



add tab cause exception

by AndroidGeek » Tue, 10 Feb 2009 01:05:03 GMT


 nd 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:57am, AndroidGeek <binli...@gmail.com> wrote:
--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


add tab cause exception

by Francisco » Sat, 07 Mar 2009 02:01:31 GMT


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

On Feb 9, 9:04am, AndroidGeek <binli...@gmail.com> wrote:
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. TouchEvent... A BIG problem

Hi,
I'm new to Android, and I love it!
I was wondering how many touch are possible at the same time?

The user click and drag (move) and while he's dragging he clicks again
(Other finger) and drag it too..

mmm, piano (multi touched) app... (with dragging)... is that possible?

Thanks

-- 

2. Cukup kuatkah hardware handset Android Premium memproses file ini??

Mohon maaf sebelumnya kalau merepotkan...memang mustahil rasanya
memproses file sebanyak itu lewat hape. Tapi sbnrnya yang dipake itu
cuma fitur find nya saja. Kasusnya gini: papa saya sebelum beli buku
dia nggak tau stok di rumah ada berapa, sudah pernah punya/belum..

Jadi kalaupun sudah bisa kebuka dan find nya berjalan dgn normal,
sudah lebih dari cukup. Begitu...makannya yang saya tanyakan, kuat
nggak android premium buka file tsb, karena buka di spica jadinya out
of memory hahaha...

Makasih sebelumnya








> > >

3. Cara bikin partisi sdcard

4. OOT: Springhill

5. OutOfMemoryError with Bitmap

6. Butuh Bantuan, Survey Android dengan Daily Social

7. How to end a child activity and return to parent activity?