Android error unable to find explicit activity class

Android error unable to find explicit activity class

The first parameter is application package not the package where the activity is.

You can invoke the Activity like this.

Intent i = new Intent();
i.setClassName(com.WAPP,
               com.WAPP.SetLocation.setLocationActivity);
startActivity(i);

It is preferred as SYLARRR suggested to have Android automatically figure that out for you. Hence the call as..

startActivity(new Intent(this, setLocationActivity.class));

Its recommended per java standards to have the package name all lower-cased and the class name as CamelCased.

If the new activity not in the same packet with MainActivity(you call from here?), try declare on manifest

<activity android_name=com.WAPP.SetLocation.setLocationActivity></activity>

and in the caller

Intent intent = new Intent(this, setLocationActivity.class);
startActivity(intent);

Hope this helps!

Android error unable to find explicit activity class

In additional to the above answers make sure that your activities are declared inside application in manifest

<application
    android_allowBackup=true
    [email protected]/app_name
    android_supportsRtl=true>

    <activity android_name=.mainScreenActivity></activity>
    <activity android_name=.SetLocation.setLocationActivity></activity>

</application>

Leave a Reply

Your email address will not be published.