public class SecondaryActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.secondary);
}
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
Intent intent = new Intent(NextActivity.this, IaiaiActivity.class);
setResult(RESULT_OK, intent);
finish();
//第一个参数为进入时动画效果,第二个参数为退出时动画效果,该方法必须紧跟在finish()方法或startActivity()方法之后
overridePendingTransition(R.anim.slide_up_in, R.anim.slide_down_out);
return false;
}
return false;
}
}