标签:ted prot view formatter activity ring oid 时间转换 epo
1 public class MainActivity extends Activity { 2 3 private Handler handler = new Handler(){ 4 @Override 5 public void handleMessage(Message msg) { 6 switch (msg.what){ 7 case 1: 8 Log.i("print","执行了"); 9 //需要执行的代码放这里 10 break; 11 } 12 } 13 }; 14 15 @Override 16 protected void onCreate(Bundle savedInstanceState) { 17 super.onCreate(savedInstanceState); 18 setContentView(R.layout.activity_main); 19 20 TimerTask task = new TimerTask() { 21 @Override 22 public void run() { 23 handler.sendEmptyMessage(1); 24 } 25 }; 26 Timer timer = new Timer(true); 27 timer.schedule(task,strToDateLong("2017-01-09 11:32:00")); 28 } 29 30 31 /** 32 * string类型时间转换为date 33 * @param strDate 34 * @return 35 */ 36 public static Date strToDateLong(String strDate) { 37 SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 38 ParsePosition pos = new ParsePosition(0); 39 Date strtodate = formatter.parse(strDate, pos); 40 return strtodate; 41 } 42 }
转自http://blog.csdn.net/Corey_Jia/article/details/51672274
标签:ted prot view formatter activity ring oid 时间转换 epo
原文地址:http://www.cnblogs.com/Sharley/p/6264730.html