public@H_502_5@
class@H_502_5@
MainActivity
extends@H_502_5@
Activity
implements@H_502_5@
OnClickListener {
SmsBean
sms
;
@Override
setContentView(R.layout.
activity_main
);
bt_create
=(Button) findViewById(R.id.
bt_create
);
//模拟短信生成
sms
=
new@H_502_5@
SmsBean(String.valueOf(random.nextInt(9999)),
"短信内容"
+i,System.currentTimeMillis());
smsList
.add(
sms
);
}
}
/**
*/
@Override
//创建xml序列化器
XmlSerializer serializer = Xml.newSerializer();
//初始化序列化器参数
serializer.setOutput(fos,
"UTF-8"
);
//开始写xml文件
serializer.text(sms.getAddress());
serializer.text(sms.getContent());
serializer.text(String.valueOf(sms.getDate()));
}
serializer.endDocument();
//关闭流资源
fos.close();
e.printStackTrace();
}
}
}