編輯:關於Android編程
方式一:
import java.text.SimpleDateFormat;
SimpleDateFormat formatter = new SimpleDateFormat ("yyyy年MM月dd日 HH:mm:ss");
Date curDate = new Date(System.currentTimeMillis());
//獲取當前時間
String str = formatter.format(curDate);
取得系統時間
1。
long time=System.currentTimeMillis();
2。
final Calendar mCalendar=Calendar.getInstance();
mCalendar.setTimeInMillis(time);
取得小時:mHour=mCalendar.get(Calendar.HOUR);
取得分鐘:mMinuts=mCalendar.get(Calendar.MINUTE);
3。
Time t=new Time(); // or Time t=new Time("GMT+8"); 加上Time Zone資料
t.setToNow(); // 取得系統時間。
int year = t.year;
int month = t.month;
int date = t.monthDay;
int hour = t.hour; // 0-23
4。
DateFormat df = new SimpleDateFormat("HH:mm:ss");
df.format(new Date());
Android開源組件小結
前言 Android自帶的組件比較丑陋(個人感覺),自己寫組件比較復雜,而且必須熟悉android應用層開發的
模版方法模式在 android中使用
模版方法模式(Template Method):模版方法模式是類的行為模式。提供一個抽象類,把一部分的邏輯以具體方法或構造子形式實現,然後聲明一些抽象方法,迫使子類實現剩
Android中Activity切換時共享視圖元素的切換動畫(4.x兼容方案)
方案一:PreLollipopTransition首先在 build.gradle 配置文件添加這個庫依賴dependencies { compile
Android 框架練成 教你打造高效的圖片加載框架
1、概述 優秀的圖片加載框架不要太多,什麼UIL , Volley ,Picasso,Imageloader等等。但是作為一名合格的程序猿,必須懂其中的實現