1

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.

Pervanee
  • 31
  • 3
  • 8
  • This might help http://stackoverflow.com/questions/3935443/android-including-multiple-java-packages-to-manifest – Suchi Jul 16 '11 at 14:54

2 Answers2

2

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!

Pervanee
  • 31
  • 3
  • 8
Pedro Loureiro
  • 11,436
  • 2
  • 31
  • 37
0

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

source.rar
  • 8,002
  • 10
  • 50
  • 82
  • public static final class layout { public static final int home_application_item=0x7f030000; public static final int home_main=0x7f030001; public static final int profile_main=0x7f030002; public static final int simple=0x7f030003; public static final int single_item=0x7f030004; } I dont know why its still missing the activity. Do u have any clue. Do I have to make some changes in my manifest file? – Pervanee Jul 16 '11 at 16:08
  • Don't quite follow, why are you explicitly declaring/importing the R.class? There is no need for that. – source.rar Jul 16 '11 at 16:15
  • I already tried without importing the .R class in the begining of each classes but then all my objects turn into errors as the errors appears right under the R letter in each findViewById(R.id.something). – Pervanee Jul 16 '11 at 22:03
  • I was referring to Android generated R.java file. Do you have more than one? Even so I wouldn't think you need to explicitly import these. – source.rar Jul 17 '11 at 07:37