1
I have 2 emulators, Nexus 5 API 23 and Nexus One API 16.
In Nexus 5 the program runs right, in Nexus One the program crasha and the error that gives is Caused by: java.lang.ClassCastException: java.lang.Object[] cannot be cast to int[][]
Makes a mistake here: meuArray=(int[][]) extras.getSerializable("array");
How is it possible for the same code to be good in one emulator and bad in the other? It has to do with API s?
EDIT:
int[][] position = new int[5][3];
if(sentado[indice].isChecked()){//Esta parte tem mais if´s mas fazem a mesma coisa que este, so varia os indices
position[0][0]++;}
Bundle bundle = new Bundle();
bundle.putSerializable("array", position);
intent.putExtras(bundle);
The problem must be before that, it must be in
put
, only if you have an example from theput
.– Guilherme Nascimento
I did another test, ran the program on 2 Nexus One emulators, only one had API 16 and one had API 23. In what had API 23 came out right, what had API 16 crashed and got some parts of the layout deformed. So I think it should be even from the @Guilhermenascimento API
– Hugo
As I said the problem is at the time of
put
Probably, without code you can’t be sure how it triggers, I mean it’s the emulator’s fault, but it’s put and not get, if you don’t put the code, you can’t be sure. http://answall.com/help/mcve– Guilherme Nascimento
already posted some code @Guilhermenascimento
– Hugo
I believe the problem is that
java.lang.Object[]
should bejava.lang.Object[][]
, maybe some values arenull
– Guilherme Nascimento
I boot all the variables(I didn’t post because it was too big) so I guess none is null @Guilhermenascimento
– Hugo
That
int position = new int[5][3];
shouldn’t be thatint[][] position = new int[5][3];
?– Guilherme Nascimento
Yeah, I just forgot to move over here, in my code it’s right @Guilhermenascimento
– Hugo