//AndroidManifest.xml
01
<?xml version="1.0" encoding="utf-8"?>
02
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
03
package="jzh.activity"
04
android:versionCode="1"
05
android:versionName="1.0" >
06
<uses-sdk android:minSdkVersion="15" />
07
<application
08
android:icon="@drawable/ic_launcher"
09
android:label="@string/app_name" >
10
<activity
11
android:name=".Activity02"
12
android:label="@string/app_name" >
13
<intent-filter>
14
<action android:name="android.intent.action.MAIN" />
15
<category android:name="android.intent.category.LAUNCHER" />
16
</intent-filter>
17
</activity>
18
<activity
19
android:name="itherActivity" >
20
</activity>
21
</application>
22
</manifest>
//Activity02
01
package jzh.activity;
02
03
import android.app.Activity;
04
import android.content.Intent;
05
import android.os.Bundle;
06
import android.view.View;
07
import android.view.View.OnClickListener;
08
import android.widget.Button;
09
10
public class Activity02 extends Activity {
11
/** Called when the activity is first created. */
12
private Button myButton =null;
13
public void onCreate(Bundle savedInstanceState) {
14
super.onCreate(savedInstanceState);
15
setContentView(R.layout.main);
16
myButton =(Button)findViewById(R.id.myButton);
17
myButton.setOnClickListener(new MyButtonListener());
18
}
19
20
class MyButtonListener implements OnClickListener{
21
public void onClick(View v) {
22
//生成一个INTENT对象
23
Intent intent = new Intent();
24
intent.setClass(Activity02.this,itherActivity.class);
25
Activity02.this.startService(intent);
26
}
27
}
28
}
//itherActivity
01
package jzh.activity;
02
03
import android.app.Activity;
04
import android.os.Bundle;
05
import android.widget.TextView;
06
07
public class itherActivity extends Activity{
08
private TextView myTextView =null;
09
@Override
10
protected void onCreate(Bundle savedInstanceState) {
11
// TODO Auto-generated method stub
12
super.onCreate(savedInstanceState);
13
setContentView(R.layout.other);
14
myTextView = (TextView)findViewById(R.id.myTextView);
15
myTextView.setText(R.string.other);
16
}
17
}
//STRING.XML
1
<?xml version="1.0" encoding="utf-8"?>
2
<resources>
3
4
<string name="hello">Hello World, Activity02!</string>
5
<string name="app_name">Activity_02</string>
6
<string name="other">OtherActivitythesecondpage</string>
7
8
</resources>
//MAIN.XML
...
//OTHER.XML
...