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. android.location.Location.distanceTo algorithm

Hello!

I'm developing an Android app with a web for GPS data handling. The
android app collects GPS data and then uploads them to a server (Java
Tomcat).

In the android app, the distance is calculated using the the
distanceTo-method in the android.location package (Location class) and
it seems to work fine.

But the problem is when I try do to the same in the web, using the
uploaded GPS data (I don't upload the distance between GPS position,
but latitude, longitude, altitude, time and speed). I still haven't
found an algorithm that calculate the distance between GPS positions
with the same result as the distanceTo-method. The best I have found
so far is this one: 
http://www.gavaghan.org/blog/free-source-code/geodesy-library-vincentys-formula-java/.

Does anyone know how the distanceTo-method calculates the distance.

Best regards,
Patrick

-- 

2. BluetoothServerSocket: how to close correctly?

Hello,
I've activity, which send files using Bluetooth. When I want to stop
server socket which is waiting for accept I call close(). After that
activity just hang. How should I close BluetoothServerSocket correctly?

-- 

3. android phone as modem

4. How to get License for OpenCore

5. To resize the SurfaceView while playing the video

6. deleteOnExit when and how does an Android JVM exit

7. SQL simple selection - urgent help needed