0
我從某些設備上獲得了此錯誤報告,而在其他應用程序正在工作如此美好!某些設備上的錯誤
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所示當在資源ID聲音文件或者未由設備支持的
@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 !!!
}
});
}
您可能需要提供更多的信息...... –
可以提供com.hamoosh.birdseffects.De7katGrid類的源代碼。 –
請再次檢查我添加了部分代碼 –