Null Pointer Exception for Player component

16 views
Skip to first unread message

Steve Marcus

unread,
Nov 8, 2013, 2:12:16 PM11/8/13
to alternate-java-bridg...@googlegroups.com
My app appears to work fine on all devices except one, the Galaxy Exhibit (SGH-T679).

On this phone they are reporting a Null Pointer Exception, to do with the Player component.

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myapp/com.example.myapp.Screen1}: java.lang.NullPointerException
.
.
Caused by: java.lang.NullPointerException
at com.xiledsystems.AlternateJavaBridgelib.components.altbridge.Player.Source(Player.java:127)
at com.example.myapp.Screen1.$define(Screen1.java:577)

I am setting the Player source in $define in the first screen, 

Player1 = new Player(this);
Player1.Source("snd_intro.mp3");

then I am setting the Player source again using when Player1.Completed (whenever the music stops)..

private void player1Completed() {
if (Convert.Boolean(tinyDB.GetValue("BGSound"))) {
Player1.Source(tinyDB.GetValue("BGSoundSource").toString());
Player1.Start();
}
else {
Player1.Source(tinyDB.GetValue("BGSoundSource").toString());
Player1.Stop();
}
}

Any ideas what could be causing this? And what would be a good solution.. Would a try/catch block be a good idea?
 

 

Imp Inc

unread,
Nov 8, 2013, 2:52:44 PM11/8/13
to alternate-java-bridg...@googlegroups.com
Not sure what's happening. It seems like it can't find the sound file. Wrapping it in a try/catch block would stop the crash, but the player wouldn't have it's source set, so you're likely to end up getting another crash somewhere else. You may want to set something in the catch to tell the app not to use the player. That will fix the crash, but it will be without sound. At least from the player. Do sounds from the Sound class work?
Reply all
Reply to author
Forward
0 new messages