如何在另一个活动中访问变量值。在我的示例中,我有一个字符串变量项,其值是微调器选择的值。如何在不使用 Intent 的情况下在另一个活动中访问此变量?
public class LoginScreen extends Activity {
Spinner sp;
String item;
Spinner sp = (Spinner) findViewById(R.id.lgnspinner);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
this, R.array.network_array,
android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
sp.setAdapter(adapter);
sp.setOnItemSelectedListener(new OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> parent, View view,
int position, long id) {
item = (String) parent.getItemAtPosition(position);
public class AgAppMenu extends Activity {