0

我有一个阻止来电的广播类。我想从活动中调用那个广播接收器?任何人都可以帮我解决这个问题。我感谢您的帮助。1.A类扩展​​活动将调用扩展BroadcastReceiver的B类,现在我想阻塞调用,仅基于某些要求,在A类中检查,如果为真则调用B类(或简称阻塞调用)

4

1 回答 1

0

您可以BroadcastReceiver 从 Activity 开始:

public static final String BROADCAST_ACTION_NAME = "PACKAGE_NAME.ACTION_NAME";
Intent intent = new Intent(BROADCAST_ACTION_NAME);  
        Bundle extras = new Bundle();  
        extras.putString("data", "any_string");  
        intent.putExtras(extras);  
        //send Broadcast from Activity
        sendBroadcast(intent); 
于 2012-11-27T06:40:04.133 回答