Hi nisha,
Here's an example of drawing on the canvas of a bitmap. Once you have a bitmap, you can place it on the screen just like any other image, or send it or whatever. You can also use this same technique to draw in the ondraw method of a view.
- Code: Select all
public Bitmap buildUpdateTime(String time) { Bitmap myBitmap = Bitmap.createBitmap(160, 84, Bitmap.Config.ARGB_4444);;
Canvas myCanvas = new Canvas(myBitmap);
Paint paint = new Paint();
//To use own font
//Typeface clock = Typeface.createFromAsset(this.getAssets(),"Carre.ttf");
paint.setAntiAlias(true);
paint.setSubpixelText(true);
paint.setTypeface(clock);
paint.setStyle(Paint.Style.FILL);
paint.setColor(Color.RED);
paint.setTextSize(65);
paint.setTextAlign(Align.CENTER);
myCanvas.drawText(time, 80, 60, paint);
return myBitmap;
}
Hope this helps.
Phyll