Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ImageView ivPct;
- Bitmap bitmap;
- Paint p;
- Canvas canvas;
- ivPct= (ImageView) findViewById(R.id.iv_pct);
- bitmap = Bitmap.createBitmap(200, 200, Bitmap.Config.ARGB_8888);
- canvas = new Canvas(bitmap);
- p = new Paint(Paint.ANTI_ALIAS_FLAG);
- int[] clr = new int[] {Color.RED, Color.YELLOW, Color.GREEN, Color.BLUE, Color.MAGENTA};
- for (int i = 0; i < clr.length; i++) {
- p.setColor(clr[i]);
- canvas.drawCircle(100, 100, 50, p);
- ivL.setImageBitmap(bitmap);
- .......
- }
- Runnable runnable = new Runnable() {
- public void run() {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- }
- h.sendEmptyMessage(qq);
- }
- };
- Thread thread = new Thread(runnable);
- thread.start();
- final Handler h = new Handler(new Handler.Callback() {
- @Override
- public boolean handleMessage(Message msg) {
- switch (msg.what) {
- case 1:
- //Перерисовка Bitmap
- }
- return true;
- }
- });
Add Comment
Please, Sign In to add comment