1)com.example.helloworld路径下创建SecondActivity.java文件:
package com.example.helloworld;
import android.app.Activity;
import android.os.Bundle;
public class SecondActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_second_layout);
}
}
2)必要的地方使用Intent启动activity
Intent intent = new Intent(HelloWorldActivity.this, SecondActivity.class);
startActivity(intent);