Results 1 to 5 of 5
- 05-19-2011, 02:17 PM #1
Member
- Join Date
- Dec 2009
- Posts
- 55
- Rep Power
- 0
Errors with start method,annotation name,interface indentife
ik this is android but i fig its basic enough this section could help me out
So i decided to try my hand at my first app without guidance from a tutorial and as i expected its been less then a smooth process. The game when started will make one out of 3 buttons appear and give users a few seconds to press it and if they dont get it in time...game over.
theres more to it id like to add but, if i could just get that far with something compilable id be happy at this point and would work my way up from there. Heres what i came up with so far. Any tips/suggestions/critiques or noticeable errors would be helpful at this point. id even be willing to pay someone to guide me threw this.
(i realize i only added one of the 4 buttons in this code but, the code from the first will just be duplicated 3 times once i get the first one up and running.)
errors read as follows:
Syntax error on token "void", @ expected
Syntax error on token "while", invalid AnnotationName
Syntax error, insert "Identifier (" to complete ConstructorHeaderName
Syntax error, insert "interface Identifier" to complete InterfaceHeader
Java Code:package com.bopit.android; import java.util.Random; import android.os.CountDownTimer; import android.widget.Button; protected static void start() { boolean gameIsAlive = true; Random dice = new Random(); int nextCommand; while(gameIsAlive) { nextCommand = 1+dice.nextInt(4); if(nextCommand=1);{ new CountDownTimer(30000,1000) { public void onTick(long millisUntilFinished) { //this is where i think i need to insert the button and animation to go with it but, //i need it to only appear when this method is called mTextField.setText("seconds remaining: " + millisUntilFinished / 1000); //button1 Button bTutorial1 = (Button) findViewById(R.id.tutorial1); bTutorial1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub gameStart.start(); } }); } @Override public void onFinish() { // TODO Auto-generated method stub }; }; }; }; }
- 05-19-2011, 02:37 PM #2
What lines do the errors occur on? Did the error message include the line number?
- 05-19-2011, 03:10 PM #3
Android or Java, this is incredibly ugly.
Java Code:}; }; }; }; }
db
edit And I'm sure Android treats an empty statement after an if block the same way as Java does.Java Code:if(nextCommand=1);{
Last edited by DarrylBurke; 05-19-2011 at 03:13 PM.
- 05-19-2011, 03:17 PM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 13,541
- Rep Power
- 27
I could be wrong, but doesn't Android use classes the same way as Java?
In which case:
Java Code:import android.widget.Button; protected static void start() {
- 05-19-2011, 04:05 PM #5
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 14,422
- Blog Entries
- 7
- Rep Power
- 29
Similar Threads
-
Using main method to start off app
By garrym in forum New To JavaReplies: 3Last Post: 04-12-2011, 11:17 PM -
having problem with returning an interface with two method
By hoangx87 in forum New To JavaReplies: 4Last Post: 03-29-2011, 07:34 AM -
Interface and abstract method
By cheesehead11 in forum New To JavaReplies: 14Last Post: 02-08-2011, 06:32 AM -
Debuggin help - simple program non-static method errors
By RR_QQ in forum New To JavaReplies: 5Last Post: 02-04-2009, 01:20 AM -
illegal start of expression & class, interface, or enum expected
By silverq_82 in forum New To JavaReplies: 9Last Post: 08-08-2007, 07:16 PM
Bookmarks