Application Fails - Dah!

Put your problem here if it does not fit any of the other categories.

Application Fails - Dah!

Postby Master_Yoda » Sat Feb 12, 2011 7:23 pm

Writing my first "Non-Book Written" app. The code syntax is correct, but the app fails. I started with making sure the “Main.xml and String.xml” were correct, then added code. It’s a
Simple math app and I can’t figure out the problem. Tried looking at “Debug” and I
Don’t understand all of what it is tell me, except I think the problem is in the
main.this.workit(); Part. Please help

:?
Attachments
main.java
(1.49 KiB) Downloaded 26 times
Master_Yoda
Freshman
Freshman
 
Posts: 7
Joined: Sat Feb 12, 2011 6:39 pm

Top

Re: Application Fails - Dah!

Postby azekrot » Sat Feb 12, 2011 7:46 pm

Logcat is _very_ useful, just take some time to read and understand it.
It will tell you exactly where the problem is.
Your TextViews are not initialized (no findViewById). Plus Integer.valueOf can throw an exception. Good luck.
azekrot
Developer
Developer
 
Posts: 49
Joined: Thu Sep 02, 2010 7:58 pm

Re: Application Fails - Dah!

Postby Master_Yoda » Sat Feb 12, 2011 9:37 pm

Ok, when I make it a "field" in "R.id" it comes back with an error: can not resolve or is not a field.
When I make it a Constent, it wants to be a field! UGH

I think it has to do with it being a TextView, but not sure why it is handled differently.

I am re-reading the Java Totorials on Field again to try and figure it out.... but help is alway appreciated!
Master_Yoda
Freshman
Freshman
 
Posts: 7
Joined: Sat Feb 12, 2011 6:39 pm

Re: Application Fails - Dah!

Postby Master_Yoda » Sun Feb 13, 2011 1:05 am

Ok, dah...

Forgot to <TextView /> my TextViews... result and result1 in Main.xml

Still crashing, but getting closer. :P
Master_Yoda
Freshman
Freshman
 
Posts: 7
Joined: Sat Feb 12, 2011 6:39 pm

Re: Application Fails - Dah!

Postby simondid » Sun Feb 13, 2011 4:04 pm

so i thing i found ther error
Code: Select all
    finishBtn.setOnClickListener (new View.OnClickListener() {


shut be like this
Code: Select all
    finishBtn.setOnClickListener (new Button.OnClickListener() {
simondid
Developer
Developer
 
Posts: 34
Joined: Mon Jan 31, 2011 3:45 pm

Re: Application Fails - Dah!

Postby Master_Yoda » Mon Feb 14, 2011 1:34 am

Actualy it worked, once I re-typed the whole $%^& thing in, and I let Eclips set the methods.

Eclips did change the method for the "workit" to "protected" instead of "private". Every other line was exactly the same.


thanks to all that helped.
Master_Yoda
Freshman
Freshman
 
Posts: 7
Joined: Sat Feb 12, 2011 6:39 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot] and 20 guests