Question

I have this code

@EActivity(R.layout.activity_app_list)
public class MainListView extends SherlockFragmentActivity

{

}

and this is the exception

android.content.ActivityNotFoundException: Unable to find explicit activity class {com.imona.android/com.imona.android.MainListView}; have you declared this activity in your AndroidManifest.xml?

Manifest

 <activity
            android:name="com.imona.android.MainListView_"
            android:label="@string/list_navigation"
            android:theme="@style/Theme.VPI" >
            <intent-filter>
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

is it ok to use Android annotation with SherlockFragmentActivity ?

Était-ce utile?

La solution

With AndroidAnnotation you have to declare the generated classes (ie: with the _ suffix) in your AndroidManifest file.

Here, it seems you're trying to start the original class instead of the generated one. You should use the builder to start your activity. Please have a look to the wiki for more information about this.

Autres conseils

You should start your activity using the AA generated class instead your class:

startActivity(this, com.imona.android.MainListView_.class);

or by using the IntentBuilder:

com.imona.android.MainListView_.intent(this).start();

Hope it helps.

The error message seems so clear. Look at this line :

android:name="com.imona.android.MainListView_"

You have declared MainListView_ , not MainListView

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top