3

我有一个 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();
        }
    }

和可序列化类

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对象。任何人都可以帮忙吗?

4

0 回答 0