In my android application suppose several activities are there if using intent I go to other activities like this.
If user choose correct answer on Activity A, it will bring to Activity C
[Activity A]->[activity C]
else, user choose the wrong answer in activity A, it will bring the user to activity B before going to Activity C
[Activity A]->[activity B]->[Activity C]
Activity C acts to show the result.
However, when I write code in Activity C to appear result. The result did not show bring me back to Activity A again.
TextView text = (TextView) findViewById(R.id.Solution);
ImageView imagee = (ImageView) findViewById(R.id.solutionImage);
String cconection = getIntent().getStringExtra("SpinConnection");//get from Activity B
String ccondition = getIntent().getStringExtra("SpinCondition");//Get from Activity B
String txtPowerSupply = getIntent().getStringExtra("PowerCable"); //get from Activity A
if (txtPowerSupply.equals("PowerOff")) {
text.setText("A+");
imagee.setImageResource(R.drawable.sakura);
}
if (cconection.equals("Not properly connected") && ccondition.equals("Good")) {
text.setText("B+");
imagee.setImageResource(R.drawable.sakura); }
Activity A
switch(view.getId()) {
case R.id.PowerOn:
if (checked)
{
Intent monpage = new Intent(ActivityA.this, com.example.lenovo.computerhardwarediagnostic.ActivityB.class);
startActivity(monpage);
}
break;
case R.id.PowerOff:
if (checked) {
//Intent intent = new Intent(getApplicationContext(), Solution.class);
//int genderID = powerSupply.getCheckedRadioButtonId();
Intent data = new Intent(ActivityA.this, com.example.lenovo.computerhardwarediagnostic.ActivityC.class);
data.putExtra("PowerCable","PowerOff");
startActivity(data);
finish();
}
break;
}
Activity B
if(fact1.equalsIgnoreCase("Not properly connected")&&fact2.equalsIgnoreCase("Good"))
{
Intent intent = new Intent(ActivityB.this, ActivityC.class);
intent.putExtra("SpinConnection","Not properly connected");
intent.putExtra("SpinCondition","Good");
startActivity(intent);
}
I'm a beginner in Android. Can you help me to solve this?