Drawing Shapes : SHA « Security « Android






Drawing Shapes

 

package app.test;
import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;

public class Test extends Activity {
  class RenderView extends View {
    Paint paint;

    public RenderView(Context context) {
      super(context);
      paint = new Paint();
    }

    protected void onDraw(Canvas canvas) {
      canvas.drawRGB(255, 255, 255);
      paint.setColor(Color.RED);
      canvas.drawLine(0, 0, canvas.getWidth() - 1,canvas.getHeight() - 1, paint);
      paint.setStyle(Style.STROKE);
      paint.setColor(0xff00ff00);
      canvas.drawCircle(canvas.getWidth() / 2, canvas.getHeight() / 2,40, paint);
      paint.setStyle(Style.FILL);
      paint.setColor(0x770000ff);
      canvas.drawRect(100, 100, 200, 200, paint);
      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));
  }
}

   
  








Related examples in the same category

1.SHA-1 string
2.hmac Sha1 Digest
3.Sha1 hashes based on a given String
4.SHA1 Utils
5.Using SharedPreferences to store password
6.Using SharedPreferences
7.Animated wallpaper draws a rotating wireframe shape with a choice of 2 shapes
8.Animation: shake
9.Get reference from SharedPreferences
10.Glutes shape
11.Reshaping Arabic Sentences and Text Utilities to deal with Arabic
12.Save SharedPreferences
13.Save value to SharedPreferences
14.SharedPreferences Set and get value
15.Compute the SHA-1 hash of the given byte array
16.compute SHA-1 Hash