Android基础(Activity)
Activity的启动和结束
我们主要看Java代码逻辑:
public class StartActivity01 extends AppCompatActivity implements View.OnClickListener {@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_start01);findViewById(R.id.btn).setOnClickListener(this);}@Overridepublic void onClick (View v) {// 页面的跳转startActivity(new Intent(this, EndActivity02.class));}}
public class EndActivity02 extends AppCompatActivity implements View.OnClickListener {@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_end02);findViewById(R.id.image_btn).setOnClickListener(this);findViewById(R.id.btn2).setOnClickListener(this);}@Overridepublic void onClick (View v) {// 回跳finish();}
}
当然返回上一个图片我们就不展示了