我知道你用的是Android手机,所以我开始学习Android开发了,只是希望未来会有一天,你也会用我做的应用。
记录Android学习历程。从这里开始。
Xzz.getXzz().learnAndroid("learn Android for you");
import java.util.Timer;
import java.util.TimerTask;
import android.os.Handler;
import android.os.Message;
/**
*
* @author xzz
*/
public class Xzz {
private static Xzz xzz;
private Handler hander = new Handler() {
@Override
public void handleMessage(Message msg) {
String purpose = (String) msg.obj;
if (purpose.equals("learn Android for you")) {
xzz.studyHard();
}
}
};
private Xzz() {
}
public synchronized static Xzz getXzz() {
if (xzz == null) {
xzz = new Xzz();
}
return xzz;
}
public void learnAndroid(String purpose) {
if (xzz == null)
return;
Message message = new Message();
message.obj = purpose;
message.setTarget(hander);
message.sendToTarget();
}
private void studyHard() {
System.out.println("learn Android");
Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
studyHard();// Never end
}
}, 24 * 60 * 60 * 1000);
}
}