Bonjour Je reçois actuellement erreur sur certaines de mes applications sur Android Market:OnListItemClick NullPointerException
C'est le stacktrace:
java.lang.NullPointerException
at ****.****.MainActivity.onListItemClick(MainActivity.java:110)
at android.app.ListActivity$2.onItemClick(ListActivity.java:319)
at android.widget.AdapterView.performItemClick(AdapterView.java:284)
at android.widget.ListView.performItemClick(ListView.java:3513)
at android.widget.AbsListView$PerformClick.run(AbsListView.java:1812)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:870)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628)
at dalvik.system.NativeStart.main(Native Method)
La partie de code où il va mal:
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
// TODO Auto-generated method stub
super.onListItemClick(l, v, position, id);
mMediaPlayer.stop();
Sound s = (Sound) l.getItemAtPosition(position);
mMediaPlayer = MediaPlayer.create(this, s.getSoundResourceId());
mMediaPlayer.start();
}
La plupart du temps ça marche (en jouant des sons) mais parfois ça donne une exception nullpointer et je ne sais pas pourquoi peut-être quelque chose avec MediaPlayer ou super.onListItemClick()?
Merci à l'avance
Quelle ligne est 110? – Pablo
mMediaPlayer.start(); – David