java.lang.RuntimeException:无法实例化接收器BroadCastReceive错误

问题描述 投票:0回答:1

 After entering a number into the edit text, it should start vibrating after the given time, firstly id does not vibrate and secondly, after few seconds it crushs

 this is my manifest file

this is my pending intent java file where I declared the vibrator

this is my UI

**我面对的错误是**

java.lang.RuntimeException:无法实例化接收者java.lang.IllegalAccessException:无法从j

访问java.lang.Class

如何摆脱这个错误。?

android broadcastreceiver alarmmanager
1个回答
0
投票

答案

此类必须为public

代码

public class PendingIntentBroadCast extends BroadcastReceiver{

    @Override
    public void onReceive(Context context, Intent intent) {

    }
}
© www.soinside.com 2019 - 2024. All rights reserved.