0

pointer application extends application.

private pointerApplication getPoa() {
    pointerApplication poa = (pointerApplication) getApplication();
    return poa;
} 

And the error:

   06-23 11:21:30.276: E/AndroidRuntime(1374): FATAL EXCEPTION: main
06-23 11:21:30.276: E/AndroidRuntime(1374): java.lang.ClassCastException: android.app.Application cannot be cast to com.startup.tryingpointers.pointerApplication
06-23 11:21:30.276: E/AndroidRuntime(1374):     at com.startup.tryingpointers.AddsubjectList.addSubject(AddsubjectList.java:49)
06-23 11:21:30.276: E/AndroidRuntime(1374):     at com.startup.tryingpointers.AddsubjectList$1.onClick(AddsubjectList.java:33)
06-23 11:21:30.276: E/AndroidRuntime(1374):     at android.view.View.performClick(View.java:4204)
06-23 11:21:30.276: E/AndroidRuntime(1374):     at android.view.View$PerformClick.run(View.java:17355)
06-23 11:21:30.276: E/AndroidRuntime(1374):     at android.os.Handler.handleCallback(Handler.java:725)
06-23 11:21:30.276: E/AndroidRuntime(1374):     at android.os.Handler.dispatchMessage(Handler.java:92)
06-23 11:21:30.276: E/AndroidRuntime(1374):     at android.os.Looper.loop(Looper.java:137)
06-23 11:21:30.276: E/AndroidRuntime(1374):     at android.app.ActivityThread.main(ActivityThread.java:5041)
06-23 11:21:30.276: E/AndroidRuntime(1374):     at java.lang.reflect.Method.invokeNative(Native Method)
06-23 11:21:30.276: E/AndroidRuntime(1374):     at java.lang.reflect.Method.invoke(Method.java:511)
06-23 11:21:30.276: E/AndroidRuntime(1374):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
06-23 11:21:30.276: E/AndroidRuntime(1374):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
06-23 11:21:30.276: E/AndroidRuntime(1374):     at dalvik.system.NativeStart.main(Native Method)

2 Answers 2

1

Make sure, in the AndroidManifest.xml, you have declared the android:name attribute of application tag with the proper class name:

<application
    android:name=".pointerApplication" >
</application>
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks rciovati, it helped a lot.
0

Try cleaning the project if it still doesn't work

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.