Android 弹出二选一窗口的实现 及Serializable
2012-05-21 17:53
369 查看
public void save() { @SuppressWarnings("rawtypes") File file = new File(SYSSETPATH); if (file.exists()) file.delete(); try { ObjectOutputStream objOutPutStream = new ObjectOutputStream( new FileOutputStream(file)); objOutPutStream.writeObject(mSystemSet); objOutPutStream.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
protected void onExit() { new AlertDialog.Builder(this).setTitle(getString(R.string.dlg_title)) .setMessage(getString("确定要退出吗?")) .setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { setResult(Msg.SYSTEMEXIT); finish(); } }).setNegativeButton(getString(R.string.no), null) .show(); }
在软件使用过程中经常会遇到点击某个按钮后弹出让我们选择 是 或者 否 的窗口,这个再android上成为dialog 今天写下二选一dialog的实现实例
setmessage是dialog的标题,setpostivebutton就是二选一的其中一个按钮,这里定义为“是”,相对应的另外一个就是否了,后面重写的onclick为选择相应的按钮后处理事件的响应, 很简单,但是要常常积累啊,初学android么,就是一步一步的积累的。
另外今天在接触 写入操作 ObjectOutputStream中的writeobject 时 必须写入的对象是序列化后的,不然会报异常,即在定义对象时 implements Serializable 借口并定义
private static final long serialVersionUID = -870520749171665437L;或者private static final long serialVersionUID = 1;
相关文章推荐
- android Activity实现从底部弹出或滑出选择菜单或窗口
- android pop自定义弹出窗口实现
- android PopupWindow实现从底部弹出或滑出选择菜单或窗口
- android PopupWindow实现从底部弹出或滑出选择菜单或窗口
- TextView使用SpannableString设置复合文本 + android弹出窗口的实现(PopupWindow)
- Android实现弹出窗口(PopUpWindow)
- Android Demo---实现从底部弹出窗口
- android Activity实现底部滑动弹出窗口及源码下载地址
- android PopupWindow实现从底部弹出或滑出选择菜单或窗口
- android中使用PopupWindow实现弹出窗口菜单
- Android开发,仿苹果的弹出窗口界面、以及窗口动画效果、窗口圆角实现。
- android弹出窗口的实现(PopupWindow)
- Android使用Activity实现从底部弹出菜单或窗口的方法
- Android Demo---实现从底部弹出窗口
- android PopupWindow实现从底部弹出或滑出选择菜单或窗口
- android PopupWindow实现从底部弹出或滑出选择菜单或窗口
- android PopupWindow实现从底部弹出或滑出选择菜单或窗口
- android PopupWindow实现从底部弹出或滑出选择菜单或窗口
- android广播中实现弹出窗口
- android弹出窗口的实现