Activity的四种加载模式(4)
来源:未知 责任编辑:责任编辑 发表时间:2014-02-18 03:21 点击:次
</activity>
</application>
两个Activity的代码如下:
Java代码
/**Activity1的代码*/
public class Activity1 extends Activity {
private static final String TAG = "Activity1";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Log.e(TAG, "Activity1 onCreate! HashCode=" + this.hashCode() + " TaskId=" + getTaskId());
}
@Override
protected void onNewIntent(Intent intent) {
Log.e(TAG, "Activity1 onNewIntent! HashCode="+ this.hashCode() + " TaskId=" + getTaskId());
super.onNewIntent(intent);
}
@Override
protected void onDestroy() {
Log.e("Activity1", "Activity1 onDestroy! HashCode="+this.hashCode()+ "TaskId="+getTaskId());
super.onDestroy();
}
/**点击进入Activity2*/
@Override
public boolean onTouchEvent(MotionEvent event) {
Intent intent = new Intent(this, Activity2.class);
startActivity(intent);
return super.onTouchEvent(event);
}
}
/**Activity2的代码*/
public class Activity2 extends Activity {
private static final String TAG = "Activity2";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>