我有一个WifiConfiguration对象列表,我希望使用此代码序列化它
WifiManager volumeControl =(WifiManager)mContext.getSystemService(Context.WIFI_SERVICE);
List<WifiConfiguration> info = volumeControl.getConfiguredNetworks();
WifiConfigSerializable WifiInfo = new WifiConfigSerializable(info.get(0));
serialize(WifiInfo.wifiList);
public void serialize(Object objToSerialize) {
ObjectOutputStream out = null;
out = new ObjectOutputStream(new FileOutputStream(SETTINGS_FILE_NAME));
out.writeObject(objToSerialize);
out.close();
} catch (Exception ex) {
ex.printStackTrace();
}
}
和Serializable Class
public class WifiConfigSerializable extends WifiConfiguration implements Serializable{
WifiConfiguration wifiList ;
private static final long serialVersionUID = 1L;
public WifiConfigSerializable( WifiConfiguration Wifi) {
this.wifiList = Wifi;
}
}
我得到以下异常java.io.NotSerializableException: android.net.wifi.WifiConfiguration
如何序列化WifiConfiguration
对象。
任何人都可以帮忙吗?