模拟Android软件试用到期提示注册
2015-11-07 17:55
423 查看
import java.io.*; import java.util.*; class RunCount { public static void main(String[] args) throws IOException { Properties pro = new Properties(); File file = new File("Count.ini");//创建Count.ini配置文件 if(!file.exists())// file.createNewFile(); FileInputStream fis = new FileInputStream(file);//输入流 pro.load(fis);//从输入流中读取 int count = 0; String value = pro.getProperty("time");//指定time记录次数属性 if(value!=null) { count = Integer.parseInt(value); if(count>5) { System.out.println("您好,试用次数已到,请充值继续使用"); return; } } count++; pro.setProperty("time",count+"");//再次计入 FileOutputStream fos = new FileOutputStream(file);//输出流 pro.store(fos,"");//写入到输出流 fos.close(); fis.close(); } }
相关文章推荐
- Android签名有关问题
- android开发的一些概念
- Android存储-file存储
- 通过android API函数操作数据库
- Android DrawerLayout和NavigationView 的使用方法
- Android View 绘制过程
- Android(9)相对布局及其属性和练习
- Android源码分析-全面理解Context (转)
- android自动更新时间时区机制
- Android 获取屏幕尺寸与密度
- Android 高清加载巨图方案 拒绝压缩图片
- Android提高第四篇之Activity+Intent
- Android屏幕录制源码Demo下载
- Android开发笔记 - 示例代码
- Android Spinner
- Android项目中如何用好构建神器Gradle?
- android 创建数据库
- Android 显示或者隐藏软键盘
- Android学习之volley
- Android下修改hosts文件