declare intent in manifest file

2019-09-07 00:14发布

I have declared a intent to access another layout on a button click, When it was run I getting following error,

android.content.ActivityNotFoundException: Unable to find explicit activity class xxxxxx; have you declared this activity in your AndroidManifest.xml?

From this I understood that intent need to be declared in android manifest file but I don't know how to declare.

Can anyone explain me how to declare<

Thanks in advance Siva

2条回答
该账号已被封号
2楼-- · 2019-09-07 00:55

u missed some like .helloListView in manifest, even check for the dot.

<activity android:name=".helloListVeiw"
              android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
查看更多
3楼-- · 2019-09-07 01:08

you need to declare your activity in android manifest.xml here is an example:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="your.package.name">
    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".Activity1" android:label="@string/app_name"></activity>
        <activity android:name=".Activity2"></activity>
    </application>
    <uses-sdk android:minSdkVersion="4" />
</manifest>
查看更多
登录 后发表回答