Hey im developing my first proper app for android and have run into 2
small hickups and was hoping for some help basicaly the main problem
is that i cant seem to change to a new view from within tabhost. I
have 4 tabs 2 just show a simple xml file the 3rd shows a series of
pictures which i want to make clickable so that they expand out into
player bio's. atm im attempting to do this in the following way but it
just causes my application to crash

package com.BPRUFC;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TabHost;

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

        TabHost mTabHost = getTabHost();

 
mTabHost.addTab(mTabHost.newTabSpec("tab_test1").setIndicator("Fixtures").setContent(R.id.fixtures));
 
mTabHost.addTab(mTabHost.newTabSpec("tab_test2").setIndicator("Results").setContent(R.id.results));
 
mTabHost.addTab(mTabHost.newTabSpec("tab_test3").setIndicator("Players").setContent(R.id.bio));
 
mTabHost.addTab(mTabHost.newTabSpec("tab_test4").setIndicator("Tour").setContent(R.id.tour));

        mTabHost.setCurrentTab(0);

        int days = 184;
        String tour2 = getString(R.string.tour, days);
    }

    public void clicked(View view)
    {
        Intent myIntent = new Intent(BPRUFCAppActivity.this,
PlayerBio.class);
        BPRUFCAppActivity.this.startActivity(myIntent);
    }
}

main Xml stopped after first pic as its quite long

<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android";
    android:id="@android:id/tabhost"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
        <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />
        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">
        <ScrollView
        android:id="@+id/ScrollView01"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" >
                <TextView
                android:id="@+id/fixtures"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:text="@string/fixtures" />
                </ScrollView>
            <TextView
                android:id="@+id/results"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:text="Results go here" />
        <ScrollView
            android:id="@+id/ScrollView02"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">
            <RelativeLayout
                            android:id="@+id/bio"
                android:layout_width="fill_parent"
                    android:layout_height="fill_parent">
                <ImageView android:layout_width="90dip"
                    android:layout_height="90dip"
                    android:id="@+id/imageView1"
                    android:src="@drawable/forrest"
                    android:onClick="clicked"
                    android:layout_alignParentTop="true"
                    android:layout_alignParentLeft="true"
                    android:layout_marginLeft="10dp"
                    android:layout_marginTop="10dp">
                </ImageView>

Thanks in advance and im sure its a noob mistake

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to