public class MainActivity extends Activity {
private Button btn1;
private Button btnSZ;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//setContentView(R.layout.dialogUp);
btn1 = (Button) findViewById(R.id.login);
btn1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
hideButton(true);
setAddDialog();
}
});
}
/**
* 设置弹出添加对话框
*/
private void setAddDialog() {
final Dialog dialog = new Dialog(MainActivity.this);
dialog.setContentView(R.layout.childmain);
dialog.setTitle("康乐操作管理");
Window dialogWindow = dialog.getWindow();
WindowManager.LayoutParams lp = dialogWindow.getAttributes();
dialogWindow.setGravity(Gravity.CENTER);
dialogWindow.setAttributes(lp);
dialog.show();
btnSZ = (Button) findViewById(R.id.btn_shangzhong);
btnSZ.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
hideButton(true);
setShangZhongAddDialog();
}
});
}
/**
* 设置上钟的弹出管理对话框
*/
private void setShangZhongAddDialog() {
final Dialog dialog = new Dialog(MainActivity.this);
dialog.setContentView(R.layout.dialogUp);
dialog.setTitle("上钟操作管理");
Window dialogWindow = dialog.getWindow();
WindowManager.LayoutParams lp = dialogWindow.getAttributes();
dialogWindow.setGravity(Gravity.CENTER);
dialogWindow.setAttributes(lp);
dialog.show();
}
//A跳转到B
public class Aactivity extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_a);
Button btn1 = (Button) findViewById(R.id.btn1);
btn1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent();
intent.putExtra("passValue", "页面传值");
intent.setClass(Aactivity.this, AactivityB.class); //设置要跳转的页面ActivtyB
startActivity(intent); //跳转
}
});
}
}
//Bactivity
public class Bactivity extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_b);
Intent intent = getIntent();
Bundle bundle = intent.getExtras();
String classnum = bundle.getString("passValue"); //获取传递的值
Button btnC = (Button) findViewById(R.id.btnC);
btnC.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent();
//intent.putExtra("passValueC", "页面传值到C");
intent.setClass(Aactivity.this, AactivityC.class); //设置要跳转的页面ActivtyC
startActivity(intent); //跳转
}
});
Button btnD = (Button) findViewById(R.id.btnD);
btnD.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent();
intent.setClass(Aactivity.this, AactivityD.class); //设置要跳转的页面ActivtyD
startActivity(intent); //跳转
}
});
}
}
//Cactivity Dactivity
Intent intent=new Intent(MainActivity.this,Intent.class);
startActivityForResult(intent,0);
android:name="com.example.morepages.Intent"
android:label="@string/app_name" >
android:name=".Intent"
android:label="@string/app_name" >
package com.example.morepages;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.content.Intent;
public class MainActivity extends Activity {
private Button btnnewpage;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btnnewpage = (Button) findViewById(R.id.btnnewpage);
btnnewpage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent=new Intent();
intent.setClass(MainActivity.this,Intent.class);
startActivity(intent);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
package com.example.morepages;
import android.app.Activity;
import android.os.Bundle;
public class Intent extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.intent);
}
}
package="com.example.morepages"
android:versiOnCode="1"
android:versiOnName="1.0" >
android:minSdkVersion="8"
android:targetSdkVersion="18" />
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
android:name="com.example.morepages.MainActivity"
android:label="@string/app_name" >
android:theme="@android:style/Theme.Dialog"
android:screenOrientation="user" android:cOnfigChanges="orientation|keyboardHidden">
xmlns:tools="http://schemas.android.com/tools"
android:layout_
android:layout_
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:cOntext=".MainActivity" >
android:layout_
android:layout_
android:drawSelectorOnTop="false"/>
android:id="@+id/textView1"
android:layout_
android:layout_
android:text="@string/hello_world" />
android:id="@+id/textView1"
android:layout_
android:layout_
android:text="TextView" />
android:name="com.example.samepages.Intent"
android:label="@string/title_activity_Intent" >