I've made an app that does the following:
activity A --> activity B --> activity C
activity A --> activity B2 --> activity C
When you close B, B2 or C, it goes to the previous activity. If you close A, it exits from the app.
If you arrive to C from B, C works in one way, but if you arrive from B2, C works in a bit different way.
This works perfectly in emulator and all devices that I could check, but a problem has appeared in two Xperia (models ARC & U) with android 4.0.4.
The problem appers when they arrive to C from B. When they close C they go back to A instead to B. If they arrive to C from B2, when they close go back to B2.
I can't understand that. It's supposed that C had to work in the same way in both cases.
And the other question is: How is possible that the app works perfectly in all devices except this two?
Any idea? How can I solve this problem?
Editing to add code:
Opening C from B:
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
// TODO Auto-generated method stub
switch (position+1) {
case 1:
if(random == true){
AnimalsBD.cmpt = Integer.parseInt(ABD.getNAct(Integer.toString(Aguila.ordre)))+1;
}
Intent a = new Intent ("com.android.JIA.Animals.1");
startActivity(a);
break;
case 2:
if(random == true){
AnimalsBD.cmpt = Integer.parseInt(ABD.getNAct(Integer.toString(Anec.ordre)))+1;
}
Intent b = new Intent ("com.android.JIA.Animals.2");
startActivity(b);
break;
Opening C from B2:
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
// TODO Auto-generated method stub
mpCorrecte = MediaPlayer.create(this, R.raw.correcte);
mpIncorrecte = MediaPlayer.create(this, R.raw.incorrecte);
if(start){
switch (position+1) {
case 1:
if(numSo==1){
start = false;
mpCorrecte.start();
mpCorrecte.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
public void onCompletion(MediaPlayer mp) {
Intent a = new Intent ("com.android.JIA.Animals.1");
startActivity(a);}
});
}else{
mpIncorrecte.start();
}
break;
case 2:
if(numSo==2){
start = false;
mpCorrecte.start();
mpCorrecte.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
public void onCompletion(MediaPlayer mp) {
Intent a = new Intent ("com.android.JIA.Animals.2");
startActivity(a);}
});
}else{
mpIncorrecte.start();
}
break;
In both cases I'm opening a final activity from a gridview. All the final activities works equally.
Thank you.