package gogler.myAndroid;
import gogler.myAndroid.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class ActivityIntentActivity extends Activity {
Button bt;
Intent intent;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
bt = (Button) this.findViewById(R.id.button1);
bt.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
intent = new Intent();
// 添加界面切换效果,注意只有Android的2.0(SdkVersion版本号为5)以后的版本才支持
int version = Integer.valueOf(android.os.Build.VERSION.SDK);
if (version >= 5) {
//overridePendingTransition(android.R.anim.fade_in,android.R.anim.fade_out);
overridePendingTransition(android.R.anim.slide_in_left,android.R.anim.slide_out_right);
}
intent.setClass(ActivityIntentActivity.this,
SecondActivity.class);
ActivityIntentActivity.this.startActivity(intent);
ActivityIntentActivity.this.finish();
}
});
}
}