0
我自己开发应用程序,我想为它设置一个密码(我的密码是ABC)。当我输入密码编辑文本如果Password = ABC
我的应用程序自动在其他密码#ABC再试一次。请帮我做到这一点! 我试过这种方法,但它有错误。错误是当我输入密码错误,并删除它,所以我的应用程序被迫关闭。简单登录方法
class mythread implements Runnable {
@Override
public void run() {
// TODO Auto-generated method stub
int i = 0;
while (i == 0) {
if (edit.getText().toString().equals(ABC)) {
android.os.Process.killProcess(android.os.Process.myPid());
}
}
}
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main)
.....
mythread thread = new mythread();
Thread td = new Thread(thread);
try {
td.sleep(500);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
td.start();
}