I am currently using android studio and I have put in my activities in the manifest file and I believe I am calling it correctly. I keep getting this error though:
Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {/com.ca.android.easycall.customers1}; have you declared this activity in your AndroidManifest.xml?
android.content.ActivityNotFoundException: Unable to find explicit activity class {/com.ca.android.easycall.customers1}; have you declared this activity in your AndroidManifest.xml?
This is my Call:
Intent actCustomers1 = new Intent(this, customers1.class);
startActivity(actCustomers1);
Here is my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ca.android.easycall"
android:versionCode="1"
android:versionName="1.0" >
<permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.ca.android.easycall.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=".customers1"
android:label="@string/title_activity_customers1" >
</activity>
<activity
android:name=".customers2"
android:label="@string/title_activity_customers2" >
</activity>
</application>
</manifest>
From what you posted, it looks like your class customers1
is not declared in package com.ca.android.easycall
When you have something like android:name=".customers1"
, Android compiler will try to prepend it with package name package="com.ca.android.easycall"
, so it becomes com.ca.android.easycall.customers1
Quoted from Android official documentation :
android:name
The name of the class that implements the activity, a subclass of Activity. The attribute value should be a fully qualified class name (such as, "com.example.project.ExtracurricularActivity"). However, as a shorthand, if the first character of the name is a period (for example, ".ExtracurricularActivity"), it is appended to the package name specified in the element.
However because you got the error log:
Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {/com.ca.android.easycall.customers1}; have you declared this activity in your AndroidManifest.xml?
So it must be either customers1 is not declared or customers1 is not in com.ca.android.easycall
package
Try this one,
<activity
android:name="com.ca.android.easycall.customers1"
android:label="@string/title_activity_customers1" >
</activity>
<activity
android:name="com.ca.android.easycall.customers2"
android:label="@string/title_activity_customers2" >
</activity>
Please edit your Manifest.xml
like this:
<activity
android:name="com.ca.android.easycall.customers1"
android:label="@string/title_activity_customers1" >
</activity>
<activity
android:name="com.ca.android.easycall.customers2"
android:label="@string/title_activity_customers2" >
</activity>
I hope this helps.
Check the package at the top of the activity file. Maybe the activities have a different package than your application.
If it is different change it to the one you have in your manifest com.ca.android.easycall
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.