I need to convert string in the edittext to bitmap, but i am not getting the string but instead i am getting this (see the image)
my code is as follows
Canvas c=new Canvas();
MainActivity.editText.setCursorVisible(false);
MainActivity.editText.buildDrawingCache();
Bitmap bmp = Bitmap.createBitmap(MainActivity.editText.getDrawingCache());
System.out.println("string is "+MainActivity.editText.getText().toString());
File f =new File(Environment.getExternalStorageDirectory().getAbsolutePath()+"/Photo Text");
if(!f.exists())
{
f.mkdirs();
}
f = new File(f.getAbsolutePath(),
String.valueOf(System.currentTimeMillis()) +"phototext.jpg");
if(!f.exists())
{
try {
f.createNewFile();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
try {
bmp.compress(Bitmap.CompressFormat.JPEG, 100, new FileOutputStream(f));
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
c.drawBitmap(bmp,0,0, mPaint);
Please suggest me. I need the string from the edittext as a bitmap.