d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Any Android Studio / Java Gurus Online?
Add Reply New Topic New Poll
Member
Posts: 18,191
Joined: May 31 2010
Gold: 149.27
Oct 15 2015 07:57pm
Would like a pair of eyes to look at my app and see whats wrong with it why it is randomly crashing, I cannot decipher the logcat either, Can pay fg.
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Oct 15 2015 08: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?
Member
Posts: 18,191
Joined: May 31 2010
Gold: 149.27
Oct 15 2015 08:10pm
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
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll