Pervanee
Pervanee

Reputation: 31

How to define several activities from different packages inside the manifest file?

I am having this problem fro couple of days. I have two packages in my project. From my home(inside home package) activity i will call my profile activity (inside proifle package)using a buttons onClickListener method. Heres the code

 private OnClickListener bProfileListener = new OnClickListener() {
    public void onClick(View v) {

        Toast.makeText(getApplicationContext(),
                " You are heading to your Profile page", Toast.LENGTH_SHORT).show();

        Intent intent = new Intent(v.getContext(), Profile.class);          
        startActivityForResult(intent, 0);

    }

}; }

Heres my manifest file. First I defines the package name like this package="com.and.profile".

<application android:label="@string/app_name"
             android:icon="@drawable/icon">
    <activity android:name=".home.Home"
              android:launchMode="singleTask"
              android:stateNotNeeded="true"
              android:label="@string/app_name"
              android:theme="@android:style/Theme.NoTitleBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.HOME"/>
            <category android:name="android.intent.category.DEFAULT"/>
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>        
    <activity android:name=".profile.Profile"
    android:label="@string/app_profile"
    android:icon="@drawable/icon"
    android:theme="@android:style/Theme.NoTitleBar">
    </activity>
    <activity android:name=".profile.CustomListViewDB"
    android:label="@string/app_profile"
    android:icon="@drawable/icon">
    </activity>
</application>

When I run this method I am getting this main error....... ERROR/AndroidRuntime(791): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.and.profile.Profile}; have you declared this activity in your AndroidManifest.xml?

Can anybody tell me what to do. Am i missing something? Thanks in adcance.

Upvotes: 1

Views: 2854

Answers (2)

Pedro Loureiro
Pedro Loureiro

Reputation: 11514

Try replacing all classes with their fully qualified name.

i.e.: change .profile.Profile to com.and.profile.Profile

That should solve it! After that, check for typos in the class name and other fields!

Upvotes: 2

source.rar
source.rar

Reputation: 8080

Have you imported the profile.Profile package (or any other you are using) in the file where you are trying to call them from?

Upvotes: 0

Related Questions