主要是簡單的Android activity頁面間的跳轉
頁面1:
- package com.layou;
-
- 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;
- import android.widget.TextView;
-
- public class Android_kaifa_05Activity extends Activity implements
- OnClickListener {
- /** Called when the activity is first created. */
- private Button button = null;
- private TextView textView;
-
- public void onCreate(Bundle savedInstanceState) {
-
- super.onCreate(savedInstanceState);
-
- setContentView(R.layout.main);
-
- button = (Button) this.findViewById(R.id.button);
-
- button.setOnClickListener(this);
-
- }
-
- public void onClick(View v) {
- if (v == button) {
- Intent intent = new Intent();
- intent.setClass(Android_kaifa_05Activity.this, Activity02.class);
- Android_kaifa_05Activity.this.startActivity(intent);
-
- }
- }
-
- }
頁面2:
- package com.layou;
-
- import android.app.Activity;
- import android.os.Bundle;
-
- public class Activity02 extends Activity {
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.ac02);
-
- }
- }