当我在单击登录按钮时提供用户名和密码时,意味着登录将成功。当我在单击复选框时提供用户名和密码时,如果我成功登录并且我现在关闭应用程序,如果我再次打开应用程序用户名和密码必须是他们在文本框中的密码。现在我直接点击登录按钮,它必须完全登录成功。
我试试这段代码
public class Login extends Activity {
CheckBox check;
private static final String UPDATE_URL = "http://202.62.91.45/NewCozyDine/login1.php3";
public ProgressDialog progressDialog;
private EditText UserEditText;
private EditText PassEditText;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
progressDialog = new ProgressDialog(this);
progressDialog.setMessage("Please wait...");
progressDialog.setIndeterminate(true);
progressDialog.setCancelable(false);
UserEditText = (EditText) findViewById(R.id.username);
PassEditText = (EditText) findViewById(R.id.password);
check=(CheckBox) findViewById(R.id.checkbox);
Button button = (Button) findViewById(R.id.okbutton);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
int usersize = UserEditText.getText().length();
int passsize = PassEditText.getText().length();
if(usersize > 0 && passsize > 0) {
progressDialog.show();
String user = UserEditText.getText().toString();
String pass = PassEditText.getText().toString();
doLogin(user, pass);
} else createDialog("Error","Please enter Username and Password");
}
});
我为 xml 解析器的登录按钮编写了(从服务器数据库验证)。如何写复选框以记住