片段:从片段给ActivityNotFoundException开幕活动: [英] Fragment :opening activity from fragment giving ActivityNotFoundException:

查看:242
本文介绍了片段:从片段给ActivityNotFoundException开幕活动:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图打开活动 Listfragment 如下

@Override
    public void onListItemClick(ListView l, View v, int position, long id) {
        super.onListItemClick(l, v, position, id);
        ((MenuActivity)getActivity()).getSlideoutHelper().close();
        Intent myIntent = new Intent(getActivity(), TravellerTimer.class);
        getActivity().startActivity(myIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY));

    }

我在注册清单文件中的 TimeTraveller 活动,但仍给予其 ActivityNotFoundException

下面是我的日志跟踪

04-19 17:14:00.030: E/AndroidRuntime(12188): FATAL EXCEPTION: main
04-19 17:14:00.030: E/AndroidRuntime(12188): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.vpiabstest/com.example.activity.TravellerTimer}; have you declared this activity in your AndroidManifest.xml?
04-19 17:14:00.030: E/AndroidRuntime(12188):    at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1556)
04-19 17:14:00.030: E/AndroidRuntime(12188):    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1431)
04-19 17:14:00.030: E/AndroidRuntime(12188):    at android.app.Activity.startActivityForResult(Activity.java:3446)
04-19 17:14:00.030: E/AndroidRuntime(12188):    at android.app.Activity.startActivityForResult(Activity.java:3407)
04-19 17:14:00.030: E/AndroidRuntime(12188):    at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:674)
04-19 17:14:00.030: E/AndroidRuntime(12188):    at android.app.Activity.startActivity(Activity.java:3617)

下面是我的清单文件

below is my manifest file

< application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

    <receiver android:name=".service.ActivityService" />
    <receiver
        android:name=".service.StartupService"
        android:enabled="true"
        android:exported="false" >
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
        </intent-filter>
    </receiver>

    <activity android:name="SampleActivity" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name=".MenuActivity"
        android:label="@string/app_name"
        android:theme="@style/MenuTheme" >
    </activity>
    <activity
        android:name=".VpiAbsTestActivity"
        android:theme="@style/Theme.VPI" />
    <activity
        android:name="com.example.activity.CreateTimer"
        android:configChanges="keyboardHidden|orientation|screenSize" />
    <activity
        android:name="com.example.activity.EditTimer"
        android:configChanges="keyboardHidden|orientation|screenSize" />
    <activity
        android:name="com.example.activity.FakeCall"
        android:configChanges="keyboardHidden|orientation|screenSize" />
    <activity
        android:name="com.example.activity.ContactList"
        android:configChanges="keyboardHidden|orientation|screenSize" />
    <activity
        android:name="com.example.activity.TravellerTimer"
        android:configChanges="keyboardHidden|orientation|screenSize" />
    <activity
        android:name="com.example.activity.TimerPrefrence"
        android:configChanges="keyboardHidden|orientation|screenSize" />

< /application>

任何帮助是AP preciated。谢谢

Any help is appreciated. thanks

推荐答案

请确保您已注册的具有完全正确的包名活动在清单

Make sure that you have registered the Activity with full correct package name in the manifest

这篇关于片段:从片段给ActivityNotFoundException开幕活动:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆