简体   繁体   中英

Unable to find activity declared in other package

When clicking a button in my application, I want to start an activity from another package.

This is my intent:

  final Intent myIntent = new Intent(getApplicationContext(), com.facebook.android.Places.class)

and this is my manifest:

<activity android:name=".com.facebook.android.Places"
            > </activity>

But i am getting unable to find explicit activity com.mypackage\\com.facebook.android.Places .

Is it impissible to start activity from another package?

Don't start an Activity from another library-project:

Create your own subclass of it:

public class MyPlaces extends com.facebook.android.Places {

@Override
   public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      ...
   }
}

Now declare your new Activity in your Manifest:

<activity android:name=".MyPlaces"> </activity>
<activity android:name=".com.facebook.android.Places"> </activity> 

Is the Places activity inside the package com.facebook.android? or is it in com.mypackage.com.facebook.android?

If the Places class is in com.facebook.android, change the manifest entry to

<activity android:name="com.facebook.android.Places"> </activity>

You dont have to start the name with "."

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM