I'm a beginner on java and android, and now I'm trying to program the "simon says" game to learn this language, but this doesn't works fine. :-(
The first and most important problem: When I try to show the sequence of colors [number 1 to 4] stored in the array seq[] with the method seq_show().... ho call but_show(x) to change the background color of each button... But I can't see the change of the backgroud color of the corresponding linearlayout...
Also I has erased the READY? source code button because is not closed before seq_show().
I do not understand this java's way to program... is not line by line, step by step... I thing is by threads and I do not understand where the pointer of the executed code is. :-(
Can someone help me ?
Then, in the method seq_input() I catch the click's on the LinearLayout... and I thing this runs fine... but I need to solve the seq_show() problem first to continue with the program.
thanks !!
Here is the source code
******************
public class MainActivity extends Activity {
public LinearLayout l1, l2, l3, l4;
public GestureDetector gd1,gd2,gd3,gd4;
public static int seq[] = new int[25];
public int seq_pos = 0;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Array pos[] amb 25 clics del joc simon
//
for (int i = 0; i < 25; i++) {
seq = (int) (Math.random() * 4) + 1;
}
// declaraci
The first and most important problem: When I try to show the sequence of colors [number 1 to 4] stored in the array seq[] with the method seq_show().... ho call but_show(x) to change the background color of each button... But I can't see the change of the backgroud color of the corresponding linearlayout...
Also I has erased the READY? source code button because is not closed before seq_show().
I do not understand this java's way to program... is not line by line, step by step... I thing is by threads and I do not understand where the pointer of the executed code is. :-(
Can someone help me ?
Then, in the method seq_input() I catch the click's on the LinearLayout... and I thing this runs fine... but I need to solve the seq_show() problem first to continue with the program.
thanks !!
Here is the source code
******************
public class MainActivity extends Activity {
public LinearLayout l1, l2, l3, l4;
public GestureDetector gd1,gd2,gd3,gd4;
public static int seq[] = new int[25];
public int seq_pos = 0;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Array pos[] amb 25 clics del joc simon
//
for (int i = 0; i < 25; i++) {
seq = (int) (Math.random() * 4) + 1;
}
// declaraci