As we discussed in our last post, we've been using the the Exerciser Monkey to test the app. We got rid of one of the errors, an anr / application not responding error, but putting the data update into an AsyncTask and got noticeably improved response time as well. However, we've not been so fortunate with a couple of other problem. The first is a null pointer exception on an empty list view; and the second is that it seem to get the media player to play the sound file more the once. In this blog, we "solve" the second issue by moving the music files to a dot-prefixed directory. Here's the blow-by-blow.
In an attempt to solve the music problm, I've put a call to stop on the media play in the onPause of the Activity that handles the audio play. As to the first, I'm just randomly tossing in a logging statement of the question at the point where it's crashing - an information-gathering exercise rather than an attempt to solve that particular problem just yet.
Ok, it double the audio replay again. I'm going to make a singleton out of the class, then only have it instantiate the media player if it's null. Something like:
Log.d(TAG, "playSoundFile start");
if (null == mp){
mp = new MediaPlayer();
}
else {
mp.stop();
}
We still have a problem with the npe - I know I've seen this question before when testing manually with no problem.
D/QuestionActivity( 566): System error, ListView is empty, exiting activity
D/QuestionActivity( 566): selView is null!!!!!!!!!!!!!!!
D/QuestionActivity( 566): childCount is : 0
D/QuestionActivity( 566): lastViewPos is : -1
D/QuestionActivity( 566): postion is : 3
D/QuestionActivity( 566): lastViewPos - position) : -4
D/QuestionActivity( 566): question is : id: 909level: 4, number: 239, levelFreqSequence: 58, kanji: 今度, hiragana: こんど, english: now,next time, nextReviewDate: null
D/AndroidRuntime( 566): Shutting down VM
W/dalvikvm( 566): threadid=1: thread exiting with uncaught exception (group=0x40015560)
E/AndroidRunti
To try to solve the dual audio, I'm creating a global in the application context, which I've subclassed, and then turn off audio when they toggle out of adio mode.
appState.autoPlay = false;
if (appState.playSoundUtil != null){
appState.playSoundUtil.stopPlay();
}
Nope. Well, I'll put the same code in the onPause in the activity which kicks it off.
Nope. It's uncanny how easily monkey gets it to do that. It's somehow kicking off the music app, which just then starts playing every mp3.
Ok, there might be some issues with the music player. I had been naming my data directory with a "." prefix to keep the audio files out of the music player, but had gone back to the regular naming for easier access during testing. For some reason, adb shell has a very difficult time working with "." prefixed directories.
So, let's change it back for now and see if that solves the problems.
Yes, that seems to do it. I got a couple of messages saying "Sorry, the player does not support that playing that type of file". I'm not sure why it's kicking off the music player, and I'm extremely curious about it. But it only happens when I run the exerciser monkey, so, since that's how I plan to distribute it, I'm marking this one as resolved. That's it for now!
No comments:
Post a Comment