Java Question ActivityNotFoundException

DonManfred

Expert
Licensed User
Longtime User
android.content.ActivityNotFoundException: Unable to find explicit activity class {b4a.example/com.wmspanel.streamer.ConnectionWizard}; have you declared this activity in your AndroidManifest.xml?

The complete trace
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
android.content.ActivityNotFoundException: Unable to find explicit activity class {b4a.example/com.wmspanel.streamer.ConnectionWizard}; have you declared this activity in your AndroidManifest.xml?
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1815)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1649)
at android.app.Activity.startActivityForResult(Activity.java:5023)
at android.app.Activity.startActivityFromFragment(Activity.java:5009)
at android.app.Activity$HostCallbacks.onStartActivityFromFragment(Activity.java:7460)
at android.app.Fragment.startActivity(Fragment.java:1130)
at android.app.Fragment.startActivity(Fragment.java:1109)
at com.wmspanel.streamer.PreferenceFragmentConnectionManager$1.onPreferenceClick(PreferenceFragmentConnectionManager.java:36)
at android.preference.Preference.performClick(Preference.java:1185)
at android.preference.PreferenceScreen.onItemClick(PreferenceScreen.java:289)
at android.widget.AdapterView.performItemClick(AdapterView.java:339)
at android.widget.AbsListView.performItemClick(AbsListView.java:1695)
at android.widget.AbsListView$PerformClick.run(AbsListView.java:4171)
at android.widget.AbsListView$13.run(AbsListView.java:6772)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6692)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)

The error appear when i click on a preference-activity button which should open a Activity.

B4X:
    private Preference.OnPreferenceClickListener mClickListener = new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference pref) {
            final String key = pref.getKey();
            if (key == null) {
                return false;
            }

            Log.d(TAG, key);
            if (key.equals(KEY_ADD)) {
                //Intent intent = new Intent(getActivity(), ConnectionWizard.class);
                Intent intent = new Intent(getActivity(), ConnectionWizard.class);
                startActivity(intent); ' java line 36
                return true;
            } else {
                DataHolder.getInstance().save(DataHolder.EDITED_CONNECTION, key);
                return false;
            }
        }
    };

The Manifest looks like this

'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="22"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.
AddManifestText( <uses-feature
android:name="android.hardware.camera"
android:required="false" />
<uses-feature
android:name="android.hardware.camera.autofocus"
android:required="false" />
<uses-feature
android:name="android.hardware.camera.front"
android:required="false" />
<uses-feature
android:name="android.hardware.camera.flash"
android:required="false" />
<uses-feature
android:name="android.hardware.camera2"
android:required="false" />

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
<uses-permission android:name="android.permission.BLUETOOTH" />
)
AddPermission(android.permission.INTERNET)
AddPermission(android.permission.CAMERA)
AddPermission(android.permission.RECORD_AUDIO)
AddPermission(android.permission.READ_EXTERNAL_STORAGE)
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)
AddPermission(android.permission.ACCESS_NETWORK_STATE)
AddPermission(android.permission.MODIFY_AUDIO_SETTINGS)
AddPermission(android.permission.BROADCAST_STICKY)
AddPermission(android.permission.BLUETOOTH)
AddApplicationText( <activity
android:name="com.wmspanel.streamer.MainActivityBase"
android:label="@string/app_name"
android:screenOrientation="landscape" />
<activity
android:name="com.wmspanel.streamer.MainActivityCamera2"
android:label="@string/app_name"
android:screenOrientation="landscape" />
<activity
android:name="com.wmspanel.streamer.MainActivityGLES"
android:configChanges="orientation|screenSize|keyboardHidden"
android:label="@string/app_name" />
<activity
android:name="com.wmspanel.streamer.SettingsActivity"
android:configChanges="orientation|screenSize|keyboardHidden"
android:label="@string/app_name" />
<activity
android:name="com.wmspanel.streamer.Connectionwizard"
android:configChanges="orientation|screenSize|keyboardHidden"
android:label="@string/app_name" />
<activity
android:name="com.wmspanel.streamer.MainActivityHorizon"
android:configChanges="orientation|screenSize|keyboardHidden"
android:label="@string/app_name" />
<!-- A simple directory chooser you can integrate into your Android app. -->
<!-- https://github.com/passy/Android-DirectoryChooser -->
<activity android:name="net.rdrei.android.dirchooser.DirectoryChooserActivity" />
)

Any hints what i have done wrong? Or any hint to fix it? :)
 

JordiCP

Expert
Licensed User
Longtime User
Just a guess. Have you tried with?
B4X:
 Intent intent = new Intent(getApplicationContext(), ConnectionWizard.class);
 

JordiCP

Expert
Licensed User
Longtime User
the code is inside one of the activity-codes. if i would change it i get an error in Eclipse and it suggests to create such a method....
Any other idea?
Sorry, no idea . I suppose you have already searched for this:
https://stackoverflow.com/questions...ind-explicit-activity-class?noredirect=1&lq=1
https://stackoverflow.com/questions...artactivity-from-a-preferen?noredirect=1&lq=1
, all the answers seem related to the intent, declaring the activity in the manifest and also an intent filter for it. Also, some people blame it on Eclipse ADT. But there doesn't seem to be a unique clear answer
 

DonManfred

Expert
Licensed User
Longtime User
com.wmspanel.streamer.Connectionwizard in the manifest editor

should be:
com.wmspanel.streamer.ConnectionWizard
wahhh... Uppercase W... actually you could see me biting in the table :oops: :D:cool:

THANK YOU :)

I´ll report the result :)
 

DonManfred

Expert
Licensed User
Longtime User
I´ll report the result :)
As expected... It does work! Thank you again for opening my eyes, Erel!

The uppercase W did the trick... Note for me; The Case for class/activity names are Case sensitive :D

PD: I see a new streaming-Engine (Wrapper for a Paid library) available in the forum soon :)
 
Top