【发布时间】:2023-03-26 05:10:02
【问题描述】:
我正在尝试开发 WiFi Direct 数据传输应用程序,this official help page 是我目前的信息来源。不过,这句话我没看懂-
For the class' constructor, you will use parameters for the WifiP2pManager, WifiP2pManager.Channel, and the activity that this broadcast receiver will be registered in.
他们所说的活动是下面类中的私有成员-
/**
* A BroadcastReceiver that notifies of important Wi-Fi p2p events.
*/
public class WiFiDirectBroadcastReceiver extends BroadcastReceiver {
private WifiP2pManager manager;
private Channel channel;
private MyWiFiActivity activity; // <-- THIS ONE
public WiFiDirectBroadcastReceiver(WifiP2pManager manager, Channel channel,
MyWifiActivity activity) {
super();
this.manager = manager;
this.channel = channel;
this.activity = activity;
}
}
当我尝试按原样实现该类时,我收到错误 Cannot resolve symbol MyWiFiActivity。
我应该包含该类型的导入,还是取决于我以后需要做的其他事情?
【问题讨论】:
标签: android wifi-direct wifip2p