i wants to set current date and time as a wall paper in android problematically. how it is possible kindly help me , thanks in advance.
答案 0 :(得分:1)
现在您可以随时调用' showCurrentTime(); '。 不要忘记每秒更新一次!:)
void showCurrentTime() {
final SurfaceHolder holder = getSurfaceHolder();
Canvas c = null;
try {
c = holder.lockCanvas();
if (c !=null) {
c.save();
c.drawColor(0xff000000);
c.drawText(new Date(System.currentTimeMillis()).toLocaleString(), mTouchX, mTouchY, mPaint);
c.restore();
}
} finally {
if (c != null) {
holder.unlockCanvasAndPost(c);
}
}
}