Reputation: 1473
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.
Upvotes: 0
Views: 198
Reputation: 23
Now you can call 'showCurrentTime();' whenever you want. Don't forget to update this every second! :)
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);
}
}
}
Upvotes: 1