public static String getCityNo(Context context, String city_name) { String city_no = null; String cityName = null; if (city_name.contains("市")) { cityName = city_name.substring(0, city_name.length() - 1); } city_no = Util.getStoredString(context, cityName, "aa"); return city_no; }
public static UserInfo getUserInfo(Context context) { UserInfo userInfo = new UserInfo(); userInfo.setUid(Util.getStoredString(context, "uid", null)); userInfo.setCode(Util.getStoredString(context, "code", null)); userInfo.setDept_code(Util.getStoredString(context, "dept_code", null)); userInfo.setDept_name(Util.getStoredString(context, "dept_name", null)); userInfo.setEmail(Util.getStoredString(context, "email", null)); userInfo.setExt(Util.getStoredString(context, "ext", null)); userInfo.setMobile(Util.getStoredString(context, "mobile", null)); userInfo.setName(Util.getStoredString(context, "name", null)); return userInfo; }
public static void writeFile(final String filePath, final File inFile) throws IOException { Util.log(TAG, "write(),filePath:" + filePath); File file = new File(filePath); if (!file.exists()) { file.createNewFile(); } OutputStream out = new FileOutputStream(file); InputStream in = new FileInputStream(inFile); int length = -1; byte[] buffer = new byte[2048]; while ((length = in.read(buffer)) > 0) { out.write(buffer, 0, length); } in.close(); out.close(); }
public static String getReadAbleTime(long time) { SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String date = format1.format(new Date(time)); Util.log(TAG, "getReadAbleTime : " + date); return date; }