private void autologin() { String active = name.getText().toString(); String password = pass.getText().toString(); if (!"".equals(active) && !"".equals(password)) { String url = "live.jsp?active=" + active + "&pass="******"&mac=" + Utils.getLocalMacAddressFromIp(LoginActivity.this); show(); loginthread = new LoginThread(this, handler, url); loginthread.start(); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); sp = this.getSharedPreferences("key", Context.MODE_PRIVATE); String active = sp.getString("name", ""); String password = sp.getString("password", ""); setContentView(R.layout.activity_login); Intent service = new Intent(this, UpdateService.class); this.startService(service); hu = new HttpUtils(this); name = (EditText) super.findViewById(R.id.name); pass = (EditText) super.findViewById(R.id.pass); loginbut = (Button) super.findViewById(R.id.loginbut); test = (Button) super.findViewById(R.id.test); name.setText(active); pass.setText(password); loginbut.setOnClickListener(new OnClickListenerImpl()); test.setOnClickListener(new OnClickListenerImpl()); mac = (TextView) super.findViewById(R.id.mac); mac.setText(Utils.getLocalMacAddressFromIp(this)); autologin(); }