我正在向 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();
}
}
这是更新的代码。请建议我在哪里做错了
谢谢