Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ActivityNotFoundException: Unable to find explicit activity class

I am trying to start an activity from my main activity. Its not working and driving me nuts. What I have is:

Intent i = new Intent ("net.xxx.View1");  
Context con = this.getBaseContext();  
ComponentName cn = new ComponentName("net.xxx.Mybooks", "BookView");  
i.setComponent(cn);  
Bundle extras = new Bundle();  
ooo             
i.putExtras(extras);
startActivity(i);     

Manifest is:  
            android:name="BookView" >
        <intent-filter >
            <action   android:name ="android.intent.action.VIEW" />
            <action   android:name ="net.xxx.View1" />       
            <category android:name ="android.intent.category.DEFAULT" />
        </intent-filter>

What I get is:
*02-03 19:34:47.448: E/AndroidRuntime(2027): android.content.ActivityNotFoundException: Unable to find explicit activity class {net.xxx.Mybooks/BookView}; have you declared this activity in your AndroidManifest.xml *
Which would be correct, I think, if the '/' was a '.'

I tried with context and without any componetName, the result is always the same.

SdkVersion="10"
Thanks in advance for your help
Cliff

like image 546
cliff2310 Avatar asked Jan 27 '26 12:01

cliff2310


2 Answers

Well despite the clams of activity not found, the problem was in the new activity. It had a null pointer exception in the code. So I spent a day or so chasing the wrong problem.

Thanks for your time anyway

Cliff

like image 74
cliff2310 Avatar answered Jan 29 '26 13:01

cliff2310


Try putting a "." in front of BookView Try doing something like this in your manifest.

<activity android:name=".BookView" >
    <intent-filter >
        <action   android:name ="android.intent.action.VIEW" />
        <action   android:name ="net.xxx.View1" />       
        <category android:name ="android.intent.category.DEFAULT" />
    </intent-filter>
</activity>
like image 28
CChi Avatar answered Jan 29 '26 12:01

CChi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!