Quote (carteblanche @ Oct 15 2015 10:02pm)
when you say "crash", do you mean you're getting an unhandled runtime exception? if so, post it.
by "randomly crashing", do you mean you can't reproduce it consistently?
When I click the splash screen button to go to a play game view, it crashes ( but it wasn't doin it last night before bed and i didn't change anything this morning)
logcat reads: 10-15 22:06:04.541 3308-3308/edu.davenport.cisp340.reflex E/AndroidRuntime: at edu.davenport.cisp340.reflex.PlayGameView.onDraw(PlayGameView.java:43)
here is my rect
Code
public void displayRec(){
Random xP = new Random(System.currentTimeMillis());
int num1 = xP.nextInt(1000);
m_target = BitmapFactory.decodeResource(getResources(),R.drawable.target);
m_targetRect = new Rect();
m_targetRect.left =num1 ; // set this to random number when game is live
m_targetRect.top = m_targetRect.left + m_target.getHeight();
m_targetRect.right = m_targetRect.left + m_target.getWidth();
m_targetRect.bottom = m_targetRect.top + m_target.getHeight();
m_timer = new ReflexTimer(1000,1000,this);
here is my rect
Code
public void onDraw(Canvas c){
c.drawBitmap(m_target, m_targetRect.left, m_targetRect.top, null);
Paint p = new Paint();
p.setTextSize(40.0f);
c.drawText("Score:", 250.0f, 65.0f,p);
c.drawText("Misses:", 550.0f, 65.0f, p);
}
I figured out what was giving me the error, I forgot I had made the displayRect() in efforts to call the method when my timer expired to redraw the target on screen.
This post was edited by Trig on Oct 15 2015 08:13pm