We can create an csv file and save it in memory card as given in link
As same way I want to create Bitmap. So please help me how to create bitmap write some text on it?
We can create an csv file and save it in memory card as given in link
As same way I want to create Bitmap. So please help me how to create bitmap write some text on it?
you can use Canvas
and drawText()
.
Bitmap bmp = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565);
Canvas c = new Canvas(bmp);
Paint paint = new Paint();
paint.setColor(Color.BLACK);
c.drawText("Hello world!", xPos, yPos, paint);
bmp.compress(Bitmap.CompressFormat.PNG, 100, new FileOutputStream(destFilePath);
You can also set the font and text-size via the Paint
-object. See How to set font and Paint.setTextSize()
.