package app.test;
import java.io.IOException;
import java.io.InputStream;
import android.app.Activity;
import android.content.Context;
import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
public class Test extends Activity {
class RenderView extends View {
Bitmap bitmap1;
Bitmap bitmap2;
Rect dst = new Rect();
public RenderView(Context context) {
super(context);
try {
AssetManager assetManager = context.getAssets();
InputStream inputStream = assetManager.open("a.png");
bitmap1 = BitmapFactory.decodeStream(inputStream);
inputStream.close();
Log.d("Text",""+bitmap1.getConfig());
inputStream = assetManager.open("b.png");
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.ARGB_4444;
bitmap2 = BitmapFactory.decodeStream(inputStream, null, options);
inputStream.close();
Log.d("BitmapText","" + bitmap2.getConfig());
} catch (IOException e) {
}
}
protected void onDraw(Canvas canvas) {
dst.set(50, 50, 350, 350);
canvas.drawBitmap(bitmap1, null, dst, null);
canvas.drawBitmap(bitmap2, 100, 100, null);
invalidate();
}
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(new RenderView(this));
}
}