sharedPreferences = getSharedPreferences("HTTP_HELPER_PREFS", Context.MODE_PRIVATE);
editor = sharedPreferences.edit();
// get the IP address and port number from the last time the user used the app,
// put an empty string "" is this is the first time.
editTextIPAddress.setText(sharedPreferences.getString(PREF_IP, ""));
editTextPortNumber.setText(sharedPreferences.getString(PREF_PORT, ""));
confbutton.setOnClickListener(this);
}
@Override
public void onClick(View v) {
// get the ip address
String ipAddress = editTextIPAddress.getText().toString().trim();
// get the port number
String portNumber = editTextPortNumber.getText().toString().trim();
editor.putString(PREF_IP, ipAddress); //
editor.putString(PREF_PORT, portNumber);
editor.commit();
onBackPressed();
我的代码我创建了第二个Activity以获取ip adresse和端口号现在我需要在主要活动中读取SharedPreferences
答案 0 :(得分:0)
像这样的东西
http://yourdomain.com/proxy