每当我在Android中切换活动时出现错误

时间:2015-01-21 17:01:56

标签: android android-activity

当其他活动空白时,我让Android按下按钮切换活动,并说" Hello World"。但是当我指定全屏功能或禁用Home键访问时,当我点击按钮说我的应用已经停止时,它会给我一个错误。

我的AndroidManifest.xml文件:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.epiclapser.noprocrastinate" >
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".MainActivity2"
            android:label="@string/title_activity_main_activity2"
            android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
        </activity>
    </application>
</manifest>

logcat的:

01-21 12:15:48.635      933-933/com.example.epiclapser.noprocrastinate     I/dalvikvm﹕ Could not find method android.view.ViewGroup.onNestedScrollAccepted, referenced from method    android.support.v7.internal.widget.ActionBarOverlayLayout.onNestedScrollAccepted
01-21 12:15:48.665      933-933/com.example.epiclapser.noprocrastinate W/dalvikvm﹕ VFY: unable to resolve virtual method 11347: Landroid/view/ViewGroup;.onNestedScrollAccepted (Landroid/view/View;Landroid/view/View;I)V
01-21 12:15:48.675      933-933/com.example.epiclapser.noprocrastinate I/dalvikvm﹕ Could not find method android.view.ViewGroup.onStopNestedScroll, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onStopNestedScroll
01-21 12:15:48.695      933-933/com.example.epiclapser.noprocrastinate W/dalvikvm﹕ VFY: unable to resolve virtual method 11353: Landroid/view/ViewGroup;.onStopNestedScroll (Landroid/view/View;)V
01-21 12:15:48.725      933-933/com.example.epiclapser.noprocrastinate I/dalvikvm﹕ Could not find method android.support.v7.internal.widget.ActionBarOverlayLayout.stopNestedScroll, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.setHideOnContentScrollEnabled
01-21 12:15:48.737      933-933/com.example.epiclapser.noprocrastinate W/dalvikvm﹕ VFY: unable to resolve virtual method 9041: Landroid/support/v7/internal/widget/ActionBarOverlayLayout;.stopNestedScroll ()V
01-21 12:15:48.775      933-933/com.example.epiclapser.noprocrastinate I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.internal.widget.TintTypedArray.getChangingConfigurations
01-21 12:15:48.785      933-933/com.example.epiclapser.noprocrastinate W/dalvikvm﹕ VFY: unable to resolve virtual method 365: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
01-21 12:15:48.795      933-933/com.example.epiclapser.noprocrastinate I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.internal.widget.TintTypedArray.getType
01-21 12:15:48.795      933-933/com.example.epiclapser.noprocrastinate W/dalvikvm﹕ VFY: unable to resolve virtual method 387: Landroid/content/res/TypedArray;.getType (I)I
01-21 12:15:50.085      933-933/com.example.epiclapser.noprocrastinate W/EGL_emulation﹕ eglSurfaceAttrib not implemented

如果您还有其他需求,请询问。

1 个答案:

答案 0 :(得分:0)

感谢所有人的回应!

我认为您可以在xml清单中声明以下内容,它应该可以正常工作。

<intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.HOME"/>
        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>