这是一个示例
从第一个活动
Bundle localBundle = new Bundle();
localBundle.putString("Loan Amount", editText1.getText().toString());
localBundle.putString("Loan Tenture", editText2.getText().toString());
localBundle.putString("Interest Rate", editText3.getText().toString());
Intent localIntent = new Intent(this, Activity2.class);
localIntent.putExtras(localBundle);
startActivity(localIntent);
并在 Activity2
String string1 = getIntent().getStringExtra("Loan Amount");
String string2 = getIntent().getStringExtra("Loan Tenture");
String string3 = getIntent().getStringExtra("Interest Rate");
对于您的情况,您可以使用 like
Bundle localBundle = new Bundle();
localBundle.putString("EmpID", "0000002");
Intent pass = new Intent(this, SecondActivity.class);
pass.putExtras(localBundle);
startActivity(pass);
在 SecondActivity 你可以得到 EmpId
String empId = getIntent().getStringExtra("EmpID");
-----------------另一种方式-----------------
Intent pass = new Intent(this, SecondActivity.class);
pass.putExtra("EmpID", "0000002");
startActivity(pass);
在第二个活动中,您可以获得 EmpId 之类的
Bundle bundle = getIntent().getExtras();
String empId = bundle.getString("EmpID");