Reputation: 73753
I am getting this error in my one activity and it is making no sense because I can go to the Calendar
activity from another activity so I know i declared it correctly in the manifest
<activity android:name=".Calendar" android:label="Calendar"/>
Intent is in a Dialog selection
Intent ok = new Intent(Events.this,Calendar.class);
ok.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity(ok); //ActivityNotFoundException
finish();
I can from activity A
to the Calendar
activity just fine then the Calendar
activity has access to my Events
activity but I cant go from my Events
to the Calendar
activity??
Ideas as to why this is?
EDIT: Update with error
08-24 12:53:46.951: ERROR/AndroidRuntime(3045): FATAL EXCEPTION: main
08-24 12:53:46.951: ERROR/AndroidRuntime(3045): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.app.notifyme/java.util.Calendar}; have you declared this activity in your AndroidManifest.xml?
08-24 12:53:46.951: ERROR/AndroidRuntime(3045): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1405)
08-24 12:53:46.951: ERROR/AndroidRuntime(3045): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
08-24 12:53:46.951: ERROR/AndroidRuntime(3045): at android.app.Activity.startActivityForResult(Activity.java:2827)
08-24 12:53:46.951: ERROR/AndroidRuntime(3045): at android.app.Activity.startActivity(Activity.java:2933)
08-24 12:53:46.951: ERROR/AndroidRuntime(3045): at com.app.notifyme.Events$12.onClick(Events.java:318)
08-24 12:53:46.951: ERROR/AndroidRuntime(3045): at com.android.internal.app.AlertController$AlertParams$3.onItemClick(AlertController.java:873)
08-24 12:53:46.951: ERROR/AndroidRuntime(3045): at android.widget.AdapterView.performItemClick(AdapterView.java:284)
08-24 12:53:46.951: ERROR/AndroidRuntime(3045): at android.widget.ListView.performItemClick(ListView.java:3513)
08-24 12:53:46.951: ERROR/AndroidRuntime(3045): at android.widget.AbsListView$PerformClick.run(AbsListView.java:1849)
08-24 12:53:46.951: ERROR/AndroidRuntime(3045): at android.os.Handler.handleCallback(Handler.java:587)
08-24 12:53:46.951: ERROR/AndroidRuntime(3045): at android.os.Handler.dispatchMessage(Handler.java:92)
08-24 12:53:46.951: ERROR/AndroidRuntime(3045): at android.os.Looper.loop(Looper.java:123)
08-24 12:53:46.951: ERROR/AndroidRuntime(3045): at android.app.ActivityThread.main(ActivityThread.java:3839)
08-24 12:53:46.951: ERROR/AndroidRuntime(3045): at java.lang.reflect.Method.invokeNative(Native Method)
08-24 12:53:46.951: ERROR/AndroidRuntime(3045): at java.lang.reflect.Method.invoke(Method.java:507)
08-24 12:53:46.951: ERROR/AndroidRuntime(3045): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
08-24 12:53:46.951: ERROR/AndroidRuntime(3045): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
08-24 12:53:46.951: ERROR/AndroidRuntime(3045): at dalvik.system.NativeStart.main(Native Method)
Upvotes: 0
Views: 308
Reputation: 200090
Import the correct package. I guess you are importing something like java.util.Calendar
in your Events
class.
If, for some reason, you need both Calendar
classes (the one you wrote and the java.util
one), you must put the complete path... for instance:
Intent ok = new Intent(Events.this, your.pkg.example.Calendar.class);
Upvotes: 1
Reputation: 12375
When you call finish()
the system actually removes the activity from the stack.
This disallows you from going back to that activity.
I suggest you carefully read the Activity Lifecycle Documentation.
It should help you figure out your problem. :)
EDIT:
You should also not need that flag. Just start the activity, the system will take care of the rest.
You also do not have access to one activity from another activity. Each activity is a standalone unit that should not attempt to access other activities.
If you need to pass data between activities, use a static class/variable in a seperate class, or pass it using Intent.putExtra()
.
Upvotes: 0