在android中,如何注冊一個類的內部類作為一個廣播接收器?
public class A extends AnotherClass {
public class B extends BroadcasetReceiver {
}
}
如何注冊一個A類中的B類,來監聽一個intent?
public class A extends AnotherClass {
B bb=new B();
IntentFilter filter=new IntentFilter("你要監聽的action");
registerReceiver(bb, filter);
public class B extends BroadcasetReceiver {
public void onReceive(){}
}
}