내 안드로이드 응용 프로그램에서 구문 분석 데이터베이스를 사용하고 있습니다. 컨트롤이 내 프로그램에 흐르는 방식에 어리둥절 해합니다. ConnectDatabse.java
.프로그램에서 제어 흐름과 혼동 됨
public class ConnectDatabase extends Activity {
public static int LOGIN_STATUS;
public static void main(String[] args) {
// TODO Auto-generated method stub
}
public static boolean authenticate(Context c, String email, String password) {
Log.d("Message", email+" & "+password);
Parse.initialize(c, "IFm3T3f7445F8fRILTcO", "HTwH2gycHQMS7LpyAf43mud");
ParseUser.logInInBackground(email, password, new LogInCallback() {
@Override
public void done(ParseUser user, ParseException e) {
// TODO Auto-generated method stub
Log.d("Inside done", "Msg: " + e);
if (user != null) {
LOGIN_STATUS = 1;
Log.d("LOGIN_STATUS value", Integer.toString(LOGIN_STATUS));
}
else {
LOGIN_STATUS = 0;
}
}
});
Log.d("After done(..)" , Integer.toString(LOGIN_STATUS));
if(LOGIN_STATUS == 1) return true;
else return false;
}
}
내 LoginActivity.java
코드는 : 다음 로그 캣 창에서
public void login(View v) {
AutoCompleteTextView emailInput = (AutoCompleteTextView) findViewById(R.id.email);
EditText passwordInput = (EditText) findViewById(R.id.password);
String email = emailInput.getText().toString();
String password = passwordInput.getText().toString();
if(ConnectDatabase.authenticate(this, email, password) == true) {
Toast toast = Toast.makeText(getApplicationContext(), "Login Successful", Toast.LENGTH_LONG);
toast.show();
}
else {
Toast toast = Toast.makeText(getApplicationContext(), "Login Unsuccessful", Toast.LENGTH_LONG);
toast.show();
}
}
"다음, 다음"후 (..) 다 "그것은 처음에"메시지 "태그, 내부 여기에 코드입니다 done "다음에"LOGIN_STATUS value "= 1
** ** 비동기식 ** ** – rupps
http://ideone.com/yVZP3Q – Selvin