public class A_Activity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_a_);
}
public void jumpA(View view) {
Intent intent =new Intent(A_Activity.this,B_Activity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
}
public class B_Activity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_b_);
}
public void jumpB(View view) {
Intent intent =new Intent(B_Activity.this,C_Activity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
}
public class C_Activity extends Activity {
private Button bc;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_c_);
bc=(Button) findViewById(R.id.buttonC);
bc.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
}
}
------解决思路----------------------
前面两个类跳转的时候,把当前的Activity finish()掉,就行了,你前面没有finish
你最后一个finish掉之后,回到的是上一个界面。