I'm testing my app on different APIs and screen resolutions and ran into a problem using Android 2.1. Whenever I run the app, the main menu works along with all the other activities I made for it, except for one: the main ga开发者_如何转开发me activity. I believe it's because the first error shown below. I'm guessing Android 2.1 doesn't support the SoundPool's OnLoadCompleteListener. I'm struggling to figure out an alternative to this so it works on both 2.2 and higher and 2.1 and lower Android versions. I'm pretty sure the OnLoadCompleteListener method is required when using SoundPool in 2.2 and above. I remember it not working without it. Anyone have suggestions?
Thanks
07-10 15:48:28.685: INFO/dalvikvm(363): Failed resolving Lorg/chinesetones/teacher/Game; interface 8 'Landroid/media/SoundPool$OnLoadCompleteListener;'
07-10 15:48:28.685: WARN/dalvikvm(363): Link of class 'Lorg/chinesetones/teacher/Game;' failed
07-10 15:48:28.685: ERROR/dalvikvm(363): Could not find class 'org.chinesetones.teacher.Game', referenced from method org.chinesetones.teacher.ChineseToneTeacherActivity.onClick
07-10 15:48:28.685: WARN/dalvikvm(363): VFY: unable to resolve const-class 38 (Lorg/chinesetones/teacher/Game;) in Lorg/chinesetones/teacher/ChineseToneTeacherActivity;
07-10 15:49:42.004: ERROR/AndroidRuntime(363): Uncaught handler: thread main exiting due to uncaught exception
07-10 15:49:42.074: ERROR/AndroidRuntime(363): java.lang.NoClassDefFoundError: org.chinesetones.teacher.Game
07-10 15:49:42.074: ERROR/AndroidRuntime(363): at
org.chinesetones.teacher.ChineseToneTeacherActivity.onClick(ChineseToneTeacherActivity.java:41)
07-10 15:49:42.074: ERROR/AndroidRuntime(363): at android.view.View.performClick(View.java:2364)
This other answers say that it's not possible
OnLoadCompleteListener Pre-2.2 No Solution
OnLoadCompleteListener Pre-2.2 No Solution
External searches seem to say the same thing
Of course it does not mean it's not possible, they said Mapview tilting could not be done and I figured out how to do it.
Unfortunately I am thinking the best solution might be load the sound why a splash screen is displayed, of course you would have to "guess" how long the sound takes to load.
Suggestion: You also might get a better idea of your problem by searching first [Android] OnLoadCompleteListener. I would also state problem more specifically in your title, for instance "What to use instead of OnLoadCompleteListener in 2.1 and below" or something like that.
The other thing you can do is get the android source code and see how they implemented the completion listener, you might be able to create something to emulate that.
精彩评论