java.lang.RuntimeException:无法启动活动计时器

时间:2014-06-06 09:18:54

标签: java android eclipse android-layout

我正在尝试创建一个天文台,但我的代码有问题。当我在平板电脑和模拟器上打开应用程序时,该应用程序无法正常工作,但此功能无需启动。

请帮助我:(或者如果你有另一个计时器脚本可用毫秒,请分享它,因为我还没有找到任何其他可以做我需要的东西。

错误:

    06-06 16:59:43.048    3724-3724/com.colorchronometer.rubiks E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.colorchronometer.rubiks/com.colorchronometer.rubiks.StopwatchActivity}: java.lang.NullPointerException
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
        at android.app.ActivityThread.access$600(ActivityThread.java:123)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)

清单:

    <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.colorchronometer.rubiks" >


<application android:icon="@drawable/icon" android:label="@string/app_name">
    <activity android:name=".StopwatchActivity"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.Black.NoTitleBar"
        android:configChanges="keyboardHidden|orientation"/>
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
</application>
</manifest>

和xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<FrameLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/parentFrameLayout">
    <ImageView
        android:src="@drawable/bkgl"
        android:scaleType="fitXY"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:id="@+id/backgroundImageView">
    </ImageView>
    <LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:id="@+id/linearLayout">

        <LinearLayout
            android:orientation="vertical"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content">

            <LinearLayout
                android:orientation="horizontal"
                android:gravity="center"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="20dp"
                android:id="@+id/timerBackground"
                android:background="@drawable/timerbackground.9">

                <TextView
                    style="@style/timerText"
                    android:text="@string/timer"
                    android:id="@+id/timer">
                </TextView>

                <TextView
                    style="@style/timerText"
                    android:text="@string/timerMs"
                    android:id="@+id/timerMs"
                    android:textSize="30sp"
                    android:paddingTop="30sp">
                </TextView>
            </LinearLayout>

            <ScrollView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom"
                android:id="@+id/scrollView">

            </ScrollView>

        </LinearLayout>

        <LinearLayout
            android:orientation="horizontal"
            android:layout_gravity="center_horizontal"
            android:gravity="center"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginTop="20dp"
            android:id="@+id/buttonArea"
            android:layout_weight="1">

            <LinearLayout
                android:orientation="vertical"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent">

                <ButtonstartButton-                        android-onClick=-startClick-
                    style="@style/buttonText"
                    android:layout_marginLeft="5dp"
                    android:background="#ff5cff9b"
                    android:textColor="#5F3A00"
                    android:shadowColor="#FBEBC5"
                    android:text="@string/startText"
                    android:layout_weight="0.5">
                </Button>

                <Button
                    style="@style/buttonText"
                    android:background="#FFFF6E75"
                    android:textColor="#2E2E2E"
                    android:shadowColor="#959597"
                    android:text="@string/resetText"
                    android:id="@+id/resetButton"
                    android:onClick="resetClick"
                    android:layout_weight="0.5">
                </Button>

                <Button
                    style="@style/buttonText"
                    android:layout_marginLeft="5dp"
                    android:layout_marginRight="5dp"
                    android:background="#ffff6e75"
                    android:textColor="#7A1100"
                    android:shadowColor="#DF726E"
                    android:text="@string/stopText"
                    android:id="@+id/stopButton"
                    android:visibility="gone"
                    android:onClick="stopClick"
                    android:layout_weight="1">
                </Button>
            </LinearLayout>

        </LinearLayout>

    </LinearLayout>
</FrameLayout>
<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_alignParentBottom="true" >

</RelativeLayout>

0 个答案:

没有答案