아래 코드는 내 사용자를 인증하는 진행률 대화 상자를 표시합니다. 나는 사용자 ID 나 암호가 일치하지 않을 때, (응답 코드가 아닙니다 200) 을 토스트 메시지를 표시하려면하지만 난토스트 메시지가 표시되지 않고 경고 메시지가 표시됨 : 포커스가있는 창을 이미 무시한 채로 있음 : com.android.internal.view
코드
를 표시하지 않습니다 경고WARN/InputManagerService(58): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy
와 토스트 메시지를 받고 있습니다
new Thread() {
public void run() {
Looper.prepare();
try {
performBackgroundProcess();
} catch (Exception e) {
Log.e("tag", e.getMessage());
}
}
}.start();
private void performBackgroundProcess() {
String sUserName = usernameEditText.getText().toString();
String sPassword = String authentication = sUserName + ":" + sPassword;
String login = Base64.encodeToString(authentication.getBytes(),
Base64.NO_WRAP);
Resources res = getResources();
String URLLogin = res.getString(R.string.URLlogin);
RestClient client = new RestClient(URLLogin, login);
try {
client.Execute(RequestMethod.POST);
} catch (Exception e) {
e.printStackTrace();
}
if (client.getResponseCode() != 200) {
progressDialog.dismiss();
Toast.makeText(getApplicationContext(),"Username or Password does not match",Toast.LENGTH_SHORT).show();
}
}
까지 내가 백그라운드에서 실행중인 코드는 백그라운드에서 실행 중입니다. 토스트를 표시하고 싶습니다 ... 비동기 작업을 사용하여 문제가 해결 될 수 있다면 제 예제를 주시겠습니까, 아니면 내 게시물을 편집하십시오. – Romi