我發送的登錄請求,Web服務,我已經啓用嚴格模式並獲得以下錯誤怎麼知道違反嚴格模式
03-05 16:54:36.490: E/AndroidRuntime(1106): FATAL EXCEPTION: main
03-05 16:54:36.490: E/AndroidRuntime(1106): android.os.StrictMode$StrictModeViolation: policy=95 violation=2
03-05 16:54:36.490: E/AndroidRuntime(1106): at android.os.StrictMode.executeDeathPenalty(StrictMode.java:1311)
03-05 16:54:36.490: E/AndroidRuntime(1106): at android.os.StrictMode.access$1300(StrictMode.java:112)
03-05 16:54:36.490: E/AndroidRuntime(1106): at android.os.StrictMode$AndroidBlockGuardPolicy.handleViolation(StrictMode.java:1304)
03-05 16:54:36.490: E/AndroidRuntime(1106): at android.os.StrictMode$AndroidBlockGuardPolicy$1.run(StrictMode.java:1191)
03-05 16:54:36.490: E/AndroidRuntime(1106): at andro
如何得到什麼在這裏侵犯。
public class LoginActivity extends Activity implements ILoginDelegate {
// Values for email and password at the time of the login attempt.
private String mEmail;
private String mPassword;
@Override
protected void onCreate(Bundle savedInstanceState) {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectAll().penaltyLog().penaltyDeath().build());
// StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll()
// .penaltyLog().penaltyDeath().build());
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
findViewById(R.id.sign_in_button).setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View view) {
attemptLogin();
}
});
}
public void attemptLogin() {
// Send login requesmEmail
try {
LoginManager manager = new LoginManager(this);
manager.sendLoginRequest(mEmail, mPassword);
} catch(Exception e) {
e.printStackTrace();
}
}
這是更新代碼。請建議我在哪裏做錯了
感謝
的崩潰可能導致如果在您的Web登錄運行ui線程。調試器是另一種選擇。 – staaar 2013-03-05 11:57:39
您可以添加源代碼如何添加Strictmode? – Yury 2013-03-05 12:16:49
我附上了我的源代碼 – 2013-03-05 12:22:09