0

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?

Community
  • 1
  • 1
Cropper
  • 1,177
  • 2
  • 14
  • 36
  • 1
    What do you mean by create Bitmap ? Are you trying to do some image processing ? What kind of Bitmap you want to create ? – GrIsHu Dec 02 '13 at 06:10
  • 1
    I want to create an plain bitmap as same size of screen with white or black background and write some strings 6-9 line like we can create csv file and write some string on it line by line and I want save this bitmap in memory card. But I have no Idea please help me. – Cropper Dec 02 '13 at 06:16

1 Answers1

1

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().

Community
  • 1
  • 1
AlexS
  • 5,295
  • 3
  • 38
  • 54