AndEngine Text Problems

Put your problem here if it does not fit any of the other categories.

AndEngine Text Problems

Postby kalango » Mon Jan 23, 2012 4:49 pm

Hello. I'm having trouble trying to add text to the and engine scene. Aparently this is not only a problem within my application, but it also happens on the AndEngine examples app.
I try to load a texture for the font and the font itself and aparently the loadFont() method is crashing the app.

Here is the log:
Code: Select all
01-23 15:44:28.341: D/AndroidRuntime(1150): Shutting down VM
01-23 15:44:28.341: W/dalvikvm(1150): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
01-23 15:44:28.411: E/AndroidRuntime(1150): FATAL EXCEPTION: main
01-23 15:44:28.411: E/AndroidRuntime(1150): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.andengine.test/com.andengine.test.AndEngineTestActivity}: java.lang.NullPointerException
01-23 15:44:28.411: E/AndroidRuntime(1150):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
01-23 15:44:28.411: E/AndroidRuntime(1150):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
01-23 15:44:28.411: E/AndroidRuntime(1150):    at android.app.ActivityThread.access$2300(ActivityThread.java:125)
01-23 15:44:28.411: E/AndroidRuntime(1150):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
01-23 15:44:28.411: E/AndroidRuntime(1150):    at android.os.Handler.dispatchMessage(Handler.java:99)
01-23 15:44:28.411: E/AndroidRuntime(1150):    at android.os.Looper.loop(Looper.java:123)
01-23 15:44:28.411: E/AndroidRuntime(1150):    at android.app.ActivityThread.main(ActivityThread.java:4627)
01-23 15:44:28.411: E/AndroidRuntime(1150):    at java.lang.reflect.Method.invokeNative(Native Method)
01-23 15:44:28.411: E/AndroidRuntime(1150):    at java.lang.reflect.Method.invoke(Method.java:521)
01-23 15:44:28.411: E/AndroidRuntime(1150):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
01-23 15:44:28.411: E/AndroidRuntime(1150):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
01-23 15:44:28.411: E/AndroidRuntime(1150):    at dalvik.system.NativeStart.main(Native Method)
01-23 15:44:28.411: E/AndroidRuntime(1150): Caused by: java.lang.NullPointerException
01-23 15:44:28.411: E/AndroidRuntime(1150):    at com.andengine.test.AndEngineTestActivity.onLoadEngine(AndEngineTestActivity.java:48)
01-23 15:44:28.411: E/AndroidRuntime(1150):    at org.anddev.andengine.ui.activity.BaseGameActivity.onCreate(BaseGameActivity.java:63)
01-23 15:44:28.411: E/AndroidRuntime(1150):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
01-23 15:44:28.411: E/AndroidRuntime(1150):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
01-23 15:44:28.411: E/AndroidRuntime(1150):    ... 11 more


Really need to get this done asap. Help me please!

PS: I'm using the default typeface to create my font.

PPS: Aparently it works if i load the font after creating the scene on the onLoadResources() method...
kalango
Freshman
Freshman
 
Posts: 2
Joined: Fri Jul 15, 2011 7:17 pm

Top

Re: AndEngine Text Problems

Postby Phyll » Mon Jan 23, 2012 5:11 pm

Hi kalango,

I don't know anything in particular about AndEngine but looking at the logcat I would say that something on line 48 in the onLoadEngine method has not been initialized.

Hope this helps.

Phyll
Phyll
Master Developer
Master Developer
 
Posts: 648
Joined: Fri Oct 14, 2011 11:19 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 13 guests