//AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="jzh.activity"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="15" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".Activity02"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="itherActivity" >
</activity>
</application>
</manifest>
//Activity02
package jzh.activity;
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;
public class Activity02 extends Activity {
/** Called when the activity is first created. */
private Button myButton =null;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
myButton =(Button)findViewById(R.id.myButton);
myButton.setOnClickListener(new MyButtonListener());
}
class MyButtonListener implements OnClickListener{
public void onClick(View v) {
//生成一个INTENT对象
Intent intent = new Intent();
intent.setClass(Activity02.this,itherActivity.class);
Activity02.this.startService(intent);
}
}
}
//itherActivity
package jzh.activity;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class itherActivity extends Activity{
private TextView myTextView =null;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.other);
myTextView = (TextView)findViewById(R.id.myTextView);
myTextView.setText(R.string.other);
}
}
//STRING.XML
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, Activity02!</string>
<string name="app_name">Activity_02</string>
<string name="other">OtherActivitythesecondpage</string>
</resources>
//MAIN.XML
...
//OTHER.XML
...