I'm trying to create a customized clock that will highlight certain intervals that I choose (like a pie slice). I'm trying to use the drawArc command for the Canvas class. However, it will only draw arcs of 360 degrees or more (full circles). I'd like to draw arcs of about 15 to 20 degrees or so. I have no idea what is wrong with my code. Can anyone figure out the problem? I know it's not being drawn behind my background because it will draw the full circle on top (you can just remove the background line of code). I'd really appreciate you all help. My code for my Activity and View class is below:
Activity Class: Code: 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: 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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---