public
class
GameView
extends
View {
public
GameView(Context context) {
super
(context);
}
@Override
protected
void
onDraw(Canvas canvas) {
super
.onDraw(canvas);
Bitmap bmp = Bitmap.createBitmap(
480
,
800
, Config.ARGB_8888);
canvas =
new
Canvas(bmp);
Paint myPaint =
new
Paint();
myPaint.setColor(Color.RED);
myPaint.setAntiAlias(
true
);
canvas.drawCircle(
50
,
50
,
50
, myPaint);
File file =
new
File(
"/sdcard/test/"
);
if
(!file.exists()){
file.mkdirs();
}
try
{
FileOutputStream fos =
new
FileOutputStream(file.getPath() +
"/1.jpg"
);
bmp.compress(Bitmap.CompressFormat.JPEG,
100
, fos);
fos.close();
}
catch
(Exception e) {
Log.e(
"Error"
, e.toString());
}
}
}