2011年7月5日

摘要: 1 public static boolean isEmail(String str) {2 Pattern p = Pattern.compile("^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$");3 Matcher m = p.matcher(str);4 if (m.matches()) {5 return true;6 }7 return false;8 } 阅读全文
posted @ 2011-07-05 16:08 还有什么 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 1 public static String generateUUID() { 2 UUID uuid = UUID.randomUUID(); 3 long msb = uuid.getMostSignificantBits(); 4 long lsb = uuid.getLeastSignificantBits(); 5 byte[] buffer = new byte[16]; 6 for (int i = 0; i < 8; i++) { 7 buffer[i] = (byte) (msb >>> 8 * (7 - i)); 8 } 9 for (int i = 阅读全文
posted @ 2011-07-05 16:07 还有什么 阅读(331) 评论(0) 推荐(0) 编辑
摘要: 1 Configuration config = Entity.APP_CONTEXT.getResources().getConfiguration();2 DisplayMetrics dm = Entity.APP_CONTEXT.getResources().getDisplayMetrics();3 config.locale = Locale.ENGLISH;4 context.getResources().updateConfiguration(config, dm); 阅读全文
posted @ 2011-07-05 16:03 还有什么 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 1 ConnectivityManager mConnectivity = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);2 if (mConnectivity.getActiveNetworkInfo() != null3 && mConnectivity.getActiveNetworkInfo().isAvailable()4 && mConnectivity.getActiveNetworkInfo().isConnected()) {5 retu 阅读全文
posted @ 2011-07-05 16:00 还有什么 阅读(149) 评论(0) 推荐(0) 编辑

2011年5月16日

摘要: 本意是想设置activity的单例,不知道是google的问题,还是怎么回事,并不能重新创建,不过可以通过@Overrideprotected void onNewIntent(Intent intent) {super.onNewIntent(intent);setIntent(intent);}以上代码会清空intent中的历史数据,以保证数据的干净。 阅读全文
posted @ 2011-05-16 21:24 还有什么 阅读(1285) 评论(0) 推荐(0) 编辑

2011年5月12日

摘要: html, body, div, span, object, blockquote, pre,abbr, acronym, address, big, cite, code,del, dfn, em, font, img, ins, kbd, q, s, samp,small, strike, strong, sub, sup, tt, var,b, u, i, center, dl, dt, dd, fieldset, form, label, legend,caption, tr, th, td { margin: 0; padding: 0; border: 0; font-size: 阅读全文
posted @ 2011-05-12 22:50 还有什么 阅读(209) 评论(0) 推荐(0) 编辑
摘要: 本意是希望再onStop的时候,能清空Bundle的数据,避免下次再进入activity的时候有历史数据残留,结果悲崔的事情发生了。getIntent().getExtras().clear(); Log.d("Bundle", getIntent().getExtras().toString());日志中显示,现实是残酷的,并没有如API上所有的能清空数据,该在的都在。最后的解决方案,再某些不需要保留历史记录的时候,调用finish(),可以变相的清空掉历史记录。 阅读全文
posted @ 2011-05-12 18:14 还有什么 阅读(4183) 评论(0) 推荐(0) 编辑

导航