Activity Class:
- Code: Select all
import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
public class AdherenceClock extends Activity {
private ClockView clockView = null;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.clockView = new ClockView(this);
//Remove the title bar, set the application to full screen, and set the orientation to landscrape
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
setContentView(this.clockView);
}
}
And the ClockView Class:
- Code: Select all
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.view.View;
public class ClockView extends View {
protected final Paint amColor = new Paint();
public ClockView(Context context) {
super(context);
this.setBackgroundDrawable(getResources().getDrawable(R.drawable.clockbackground));
this.amColor.setARGB(100, 248, 225, 110);
}
@Override
protected void onDraw(Canvas canvas) {
float startAngle = 0;
float sweepAngle = 60;
RectF clockRect = new RectF(86, 314, 394, 6);
canvas.drawArc(clockRect, startAngle, sweepAngle, true, this.amColor);
}
}
Thanks.

