public class MainActivity extends AppCompatActivity {
int loop = 1;
int points = 0;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
for(loop == 1);{//the error is here
}
public void click(){
points++;
}
}
it doesnt see loop(int) and I don`t know why.
I am trying to make a clicker game, so more tips would be really appreciated.
You are writing your code outside the onCreate method. The code must either be within the onCreate() or inside another function.
public class MainActivity extends AppCompatActivity {
int loop = 1;
int points = 0;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
for(loop == 1){
// Write your code here
}
}
public void click(){
points++;
}
}