当我运行脚本登录或注册 php mysql 时,出现如下错误。
com.example.kalyan E/Surface: getSlotFromBufferLocked: unknown buffer: 0xb40553a0
E/WindowManager: android.view.WindowLeaked: Activity com.example.kalyan.LoginActivity_old has leaked window com.android.internal.policy.PhoneWindow$DecorView{37f55bd V.E...... R....... 0,0-840,1132} that was originally added here
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:368)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:299)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:85)
at android.app.Dialog.show(Dialog.java:319)
at com.example.kalyan.LoginActivity_old.showRegisterDialog(LoginActivity_old.java:233)
at com.example.kalyan.LoginActivity_old.onClick(LoginActivity_old.java:172)
at android.view.View.performClick(View.java:5198)
at android.view.View$PerformClick.run(View.java:21147)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
07-08 14:00:03.245 16742-16782/com.example.kalyan E/Surface: getSlotFromBufferLocked: unknown buffer: 0xb40571d0
07-08 14:00:03.247 16742-16742/com.example.kalyan E/WindowManager: android.view.WindowLeaked: Activity com.example.kalyan.LoginActivity_old has leaked window com.android.internal.policy.PhoneWindow$DecorView{68547b2 V.E...... R....... 0,0-1026,252} that was originally added here
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:368)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:299)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:85)
at android.app.Dialog.show(Dialog.java:319)
at com.example.kalyan.LoginActivity_old$Registration.onPreExecute(LoginActivity_old.java:329)
at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:604)
at android.os.AsyncTask.execute(AsyncTask.java:551)
at com.example.kalyan.LoginActivity_old$1.onClick(LoginActivity_old.java:206)
at android.view.View.performClick(View.java:5198)
at android.view.View$PerformClick.run(View.java:21147)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
07-08 14:00:03.252 16742-16782/com.example.kalyan E/Surface: getSlotFromBufferLocked: unknown buffer: 0xb4057160
07-08 14:00:04.002 16742-16778/com.example.kalyan I/GMPM: Tag Manager is not found and thus will not be used
07-08 14:00:04.896 16742-16814/com.example.kalyan I/Process: Sending signal. PID: 16742 SIG: 9
多谢你们。
我的代码是:
public class LoginActivity_old extends Activity implements OnClickListener {
Button submitBtn, registerBtn, forgotpassBtn;
EditText emailEt, passwordEt;
//SessionManager session;
//Driver Login Fields
EditText drloginEmail;
EditText drloginPassword;
TextView drloginResult;
Button loginSubmitBtn;
//Registration Fields
EditText registrationName, registrationEmail, registrationPhone, registrationPassword, registrationConfirmPassword;
TextView registrationResult;
//LostPass Fields
EditText lostPassEmail;
TextView lostPassResltText;
SharedPreferences sh;
JSONParser jparser = new JSONParser();
private static final String regiURL = "http://10.0.2.2/appslider/registration.php";
public static final String loginURL = "http://10.0.2.2/appslider/login.php";
public static final String getDataURL = null;
public static final String recoverPasswordURL = "http://10.0.2.2/sendmail.php";
Context con;
/**
* ATTENTION: This was auto-generated to implement the App Indexing API.
* See https://g.co/AppIndexing/AndroidStudio for more information.
*/
private GoogleApiClient client;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login_layout);
con = LoginActivity_old.this;
sh = getSharedPreferences("CRUZER_PREF", MODE_PRIVATE);
init();
String email = sh.getString("loginemail", null);
String pass = sh.getString("loginpass", null);
boolean driver = sh.getBoolean("type", false);
if (email != null && pass != null && !driver) {
emailEt.setText(email);
passwordEt.setText(pass);
submitBtn.performClick();
} else if (email != null && pass != null && driver) {
showDriverLoginDialog();
drloginEmail.setText(email);
drloginPassword.setText(pass);
loginSubmitBtn.performClick();
}
// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();
}
private void init() {
submitBtn = (Button) findViewById(R.id.loginSubmitBtn);
registerBtn = (Button) findViewById(R.id.loginRegisterBtn);
forgotpassBtn = (Button) findViewById(R.id.loginForgotPassBtn);
submitBtn.setOnClickListener(this);
registerBtn.setOnClickListener(this);
forgotpassBtn.setOnClickListener(this);
emailEt = (EditText) findViewById(R.id.loginEmailEt);
passwordEt = (EditText) findViewById(R.id.loginPassEt);
}
//@Override
//public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
// getMenuInflater().inflate(R.menu.login, menu);
// return true;
//}
//@Override
//public boolean onOptionsItemSelected(MenuItem item) {
// switch (item.getItemId()) {
// case R.id.driverloginmenu:
// showDriverLoginDialog();
// break;
// }
// return super.onOptionsItemSelected(item);
//}
@Override
public void onClick(View v) {
if (!Util.isConnectingToInternet(this)) {
Util.showNoInternetDialog(this);
return;
}
switch (v.getId()) {
case R.id.loginSubmitBtn:
if (!TextUtils.isEmpty(emailEt.getText().toString())) {
if (!TextUtils.isEmpty(passwordEt.getText().toString())) {
new Login().execute("client");
} else
Toast.makeText(this, "Please enter your password", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(this, "Please enter your email address", Toast.LENGTH_SHORT).show();
}
break;
case R.id.loginRegisterBtn:
showRegisterDialog();
break;
case R.id.loginForgotPassBtn:
showLostPasswordDialog();
break;
}
}
}
这是供参考的登录代码。谢谢。