How to solve NullPointerException error in Android?

后端 未结 3 550
时光说笑
时光说笑 2020-12-02 02:15

The below code runs smoothly in the emulator from Eclipse, but there are problems when I run it on my Android phone and tablet.

public class RingerActivity e         


        
3条回答
  •  臣服心动
    2020-12-02 02:56

    NullPointerException means that mp is null. This means the MediaPlayer.create() failed. Does R.raw.alarm exist?

提交回复
热议问题