我从某些设备收到此错误报告,而在其他应用程序上运行良好!!!
java.lang.NullPointerException
at com.hamoosh.birdseffects.De7katGrid$1.onItemClick(De7katGrid.java:44)
at android.widget.AdapterView.performItemClick(AdapterView.java:292)
at android.widget.AbsListView.performItemClick(AbsListView.java:1359)
at android.widget.AbsListView$PerformClick.run(AbsListView.java:2988)
at android.widget.AbsListView$1.run(AbsListView.java:3783)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4517)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
at dalvik.system.NativeStart.main(Native Method)
源代码哪里没有错误??
这部分代码中显示的错误行是 44
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.grid_layout);
GridView gridView = (GridView) findViewById(R.id.grid_view);
// Instance of ImageAdapter Class
gridView.setAdapter(new ImageAdapter(this));
gridView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View v,
int position, long id) {
stopPlaying();
mp = MediaPlayer.create(De7katGrid.this, mSongsIds[position]);
mp.start();// << here is line 44 !!!
}
});
}