Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
errors
05-14 07:55:04.787 16586-16625/com.example.potss.sweethomebakeshopmobile E/Buffer Error﹕ Error converting result java.lang.NullPointerException: lock == null
05-14 07:55:04.787 16586-16625/com.example.potss.sweethomebakeshopmobile E/JSON Parser﹕ Error parsing data org.json.JSONException: End of input at character 0 of
05-14 07:55:04.798 16586-16625/com.example.potss.sweethomebakeshopmobile W/dalvikvm﹕ threadid=12: thread exiting with uncaught exception (group=0x4187dda0)
05-14 07:55:04.798 16586-16625/com.example.potss.sweethomebakeshopmobile E/AndroidRuntime﹕ FATAL EXCEPTION: AsyncTask #1
Process: com.example.potss.sweethomebakeshopmobile, PID: 16586
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:300)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
Caused by: java.lang.NullPointerException
at com.example.potss.sweethomebakeshopmobile.sweetlogin$SubmitLogin.doInBackground(sweetlogin.java:86)
at com.example.potss.sweethomebakeshopmobile.sweetlogin$SubmitLogin.doInBackground(sweetlogin.java:67)
at android.os.AsyncTask$2.call(AsyncTask.java:288)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
            at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at java.lang.Thread.run(Thread.java:841)
05-14 07:55:05.158 16586-16586/com.example.potss.sweethomebakeshopmobile W/IInputConnectionWrapper﹕ showStatusIcon on inactive InputConnection
05-14 07:55:05.308 16586-16586/com.example.potss.sweethomebakeshopmobile E/WindowManager﹕ android.view.WindowLeaked: Activity com.example.potss.sweethomebakeshopmobile.sweetlogin has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{42b20a98 V.E..... R......D 0,0-1026,288} that was originally added here
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:457)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:267)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
at android.app.Dialog.show(Dialog.java:288)
at com.example.potss.sweethomebakeshopmobile.sweetlogin$SubmitLogin.onPreExecute(sweetlogin.java:76)
at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:587)
at android.os.AsyncTask.execute(AsyncTask.java:535)
at com.example.potss.sweethomebakeshopmobile.sweetlogin.login(sweetlogin.java:64)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at android.view.View$1.onClick(View.java:3964)
at android.view.View.performClick(View.java:4633)
at android.view.View$PerformClick.run(View.java:19330)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5356)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
at dalvik.system.NativeStart.main(Native Method)
05-14 07:55:08.431 16586-16625/com.example.potss.sweethomebakeshopmobile I/Process﹕ Sending signal. PID: 16586 SIG: 9



sweetlogin.java

import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;
import android.widget.EditText;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;


public class sweetlogin extends ActionBarActivity {
/*Button login;
Button register;
Toolbar toolbar;

AlertDialog.Builder alert;

EditText userTextField, passTextField;
ProgressDialog pDialog;
JSONParser jsonParser = new JSONParser();
private static final String LOGIN_URL = "http://shbs-onli.com/aa/login.php";*/

private ProgressDialog pDialog;
JSONParser jsonParser = new JSONParser();
private static String url_check_login = "http://shbs-onli.com/aa/login";
private static final String TAG_SUCCESS = "success";
Context context = this;
EditText uname, pword;
Boolean nega = false;
Toolbar toolbar;
AlertDialog.Builder alert;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTitle("Home");
setContentView(R.layout.activity_sweetlogin);
toolbar = (Toolbar) findViewById(R.id.app_bar2);
setSupportActionBar(toolbar);
alert = new AlertDialog.Builder(this);

getSupportActionBar().setDisplayHomeAsUpEnabled(true);
uname = (EditText) findViewById(R.id.editText);
pword = (EditText) findViewById(R.id.editText2);
}


public void login(View v){
new SubmitLogin().execute();
}

class SubmitLogin extends AsyncTask<string,> {

@Override
protected void onPreExecute() {
super.onPreExecute();
pDialog = new ProgressDialog(sweetlogin.this);
pDialog.setMessage("Logging In ...");
pDialog.setIndeterminate(false);
pDialog.setCancelable(true);
pDialog.show();
}

protected String doInBackground(String... args) {

List<namevaluepair> params = new ArrayList<namevaluepair>();
params.add(new BasicNameValuePair("User",uname.getText().toString()));
params.add(new BasicNameValuePair("Password",pword.getText().toString()));
JSONObject json = jsonParser.makeHttpRequest(url_check_login,"POST", params);

Log.d("Create Response", json.toString());
try {
int success = json.getInt(TAG_SUCCESS);
if (success == 1) {
nega = false;
Intent gotoLogs = new Intent(context, sweethome.class);
startActivity(gotoLogs);
finish();
} else {
nega = true;
}
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
protected void onPostExecute(String file_url) {
pDialog.dismiss();
if(nega){
new AlertDialog.Builder(context)
.setTitle("Login Failed")
.setMessage("Wrong Username or Password")
.setNegativeButton(android.R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {

}
})
.setIcon(android.R.drawable.ic_dialog_alert)
.show();
}
}

}
public void gotoSignIn(View v){
Intent gotoRegister = new Intent(this, register.class);
startActivity(gotoRegister);
}

}
Posted
Comments
Sergey Alexandrovich Kryukov 13-May-15 20:23pm    
Well, this is code dump, with exception stack. So what? Where is the question.
—SA
Dadecki 14-May-15 3:30am    
Write your question please...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900