2

Im doing Android Live Wallpaper.It provides the user to give text input dynamically.That text should be displayed on wallpaper or scrolling like that.And this wallpapers have to be set as background.How could i do this.?

Ganapathy C
  • 5,989
  • 5
  • 42
  • 75
sanjay
  • 2,590
  • 17
  • 55
  • 88

1 Answers1

3

You can use this.

final SurfaceHolder holder = getSurfaceHolder();

try {
     Canvas _canvas = holder.lockCanvas();
     if (_canvas != null)
     {
         drawAnimation(_canvas);
     }
}
finally
     {
         if (_canvas != null)
              holder.unlockCanvasAndPost(_canvas);
     }

and then in your drawAnimation function

private void drawAnimation(Canvas c) 
{
    c.drawText(text, x, y, paint);
}

You can use this and you can see if y>height_screen first line replace to second line and after that second line will be a first line. And you can do this for all line, after that you will see that your last line will be empty, add your new text in last line. I hope it helps you.

George
  • 1,327
  • 11
  • 25