100 thoughts on “Android Login and Registration Tutorial with PHP MySQL”

  1. Hi Belal. Can you explain this to me please.. I got error “Cannot resolve symbol s” in mainactivity.java line129. Why we use “s” in there

    Reply
    • If you are using a free hosting.. then you have to use the free sub domain that you got from that free hosting.. I would recommend that don’t use a free host, they just suck and you might face a lot of troubles. Use XAMPP, WAMP or a paid hosting.

      Reply
  2. Error :- System.err: org.json.JSONException: End of input at character 0 of

    JSONObject obj = new JSONObject(s); Here is show the error and class RegisterUser extends AsyncTask Here its show the error.

    Reply
  3. Api.php showing me this message:

    connect_error) { die(“Connection failed: ” . $conn->connect_error); } {“error”:true,”message”:”Invalid API Call”}

    Do i have to make changes in Api.php as well?

    Reply
  4. i get this error
    connect_error) { die(“Connection failed: ” . $conn->connect_error); } {“error”:true,”message”:”Invalid API Call”}

    Reply
  5. hello,
    when i try to test signup i see this error on postman,

    Fatal error: Call to a member function prepare() on null in

    do you know how can i fix this?

    Reply
  6. Android Login and Registration Tutorial with PHP MySQL

    I have been attempting to download the source code for the above project. Besides subscribing to the newsletter, I have also provided the requested like for access to the download, but still I just get a screen which says download is locked.

    How do I / WE solve this dilema.

    Thanks

    Reply
  7. Android Login and Registration Tutorial with PHP MySQL

    I have been attempting to download the source code for the above project. Besides subscribing to the newsletter, I have also provided the requested like for access to the download, but still I just get a screen which says download is locked.

    How do I / WE solve this dilema.

    Thanks

    Reply
  8. hello
    thank you so much for this tutorials. but I face difficulty in “SharedPreferences” means when I update data in the database table and again load profile activity, its display old data. I want updated data. please help asap.

    Reply
  9. I am getting socket time out exception and org.json.JSONException: End of input at character 0 of this exception please solve this issue.

    Reply
  10. Hello Belal sir i got the error is org.json.JSONException: Value http of type java.lang.String cannot be converted to JSONObject how to solve this problem.

    Reply
  11. my exception error is solved but now in php code is not run successfully. the error is {“error”:true,”message”:”required parameters are not available”} plz reply fast sir.

    Reply
  12. Hello, when I use postman to test Api.php?apicall=signup i have an error :
    {“error”:true,”message”:”required parameters are not available”}

    I don’t understand why because i used ur source code, if you have a solution .. i want it please ! ^^

    Reply
  13. W/System.err: org.json.JSONException: No value for user
    04-06 16:18:39.254 5162-5162/com.zelectrospace.ramikki W/System.err: at org.json.JSONObject.get(JSONObject.java:389)
    at org.json.JSONObject.getJSONObject(JSONObject.java:609)
    at com.zelectrospace.ramikki.account$1UserLogin.onPostExecute(account.java:134)
    at com.zelectrospace.ramikki.account$1UserLogin.onPostExecute(account.java:110)
    at android.os.AsyncTask.finish(AsyncTask.java:636)
    at android.os.AsyncTask.access$500(AsyncTask.java:177)
    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:653)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    04-06 16:18:39.255 5162-5162/com.zelectrospace.ramikki W/System.err: at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5254)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

    Reply
  14. Thank you. This tutorial is very useful for me…
    Now, I want to upload the image from registration form and save this image on my server folder..how can I do this..please give me a suggestion…

    Reply
  15. Hello, I’m a beginner in PHP.
    I would like to understand what this stanza means “$ stmt = $ conn-> prepare (” SELECT id, username, in “linking the prepare, because for me it did not work.
    I’m using the PHP 7.0 bug.
    Is there a relationship?

    Reply
  16. when I use postman to test Api.php?apicall=signup i have an error :
    {“error”:true,”message”:”required parameters are not available”}

    Reply
  17. Sir if my ‘KEY_ID’ type is STRING how can i complete SharedPreferences Manager Class ? because it must be use INT but i already have data the ID type is STRING
    thank you…

    Reply
  18. Everything works fine, but when i register or login after i fill the blanks with right information the onPostExecute wont take me to ProfileActivity using startActivity, i tried changing profileactivity to mainactivity in startActivity argument and it also didnt start the activity..please help me with this problem..

    Reply
  19. Hello , How can i check this in postman, i am getting error like connected{“error”:true,”message”:”required parameters are not available”}

    Reply
  20. Register page does not open the profile page .progress bar shows and it stays on the same page .
    {“error”:true,”message”:”Invalid API Call”}
    what to do?

    Reply
  21. Simply wish to say your article is as astonishing. The clarity on your publish is just nice and that i could suppose you’re knowledgeable on this subject. Well with your permission allow me to take hold of your feed to stay up to date with drawing close post. Thank you one million and please continue the rewarding work.

    Reply
  22. Hi. I really appreciate for all of your tutorials. While executing Login and Sing Up tutorials, I got an error that says error org.json.JSONException: End of input at character 0 of . I kind of did research for this error and some says I have to put sending request method into doInBackground because while getting no message, the program is parsing Json. I just wanted to know if the code above works as it is. Thanks again from South Korea.

    Reply
  23. Hey Belal,
    That’s one coolest project i’ve seen till date.
    I just have one small problem.This code is successfully compiling and running too.
    The only problem is that , the page isn’t responding. I inserted values through postman and those are entered into mysql database. But the values send through this Android app aren’t. The values aren’t entring the database.
    Can you tell me where the error i made please.
    Answer me ASAP. :))

    Thanks.

    Reply
  24. Good way of explaining, and pleasant paragraph to take data concerning my presentation subject, which i am going to convey in academy.

    Reply
  25. Attempt to invoke virtual method ‘void android.widget.ProgressBar.setVisibility(int)’ on a null object reference
    this error shown in this code please help me

    Reply
  26. Terrific post however I was wanting to know if you could write a litte more on this topic? I’d be very grateful if you could elaborate a little bit further. Appreciate it!

    Reply
  27. You actually make it seem so easy together with your presentation but I in finding this matter to be really something that I think I might never understand. It seems too complex and very huge for me. I am looking ahead in your next publish, I will attempt to get the grasp of it!

    Reply
  28. im getting error on sharedPrefManager saying cannot resolve method getId(). I have tried creating a getId method in the user class but still does not work. What else can i do to fix this?

    Reply
  29. nothing happen when i click on the register button the data is not going to db even not enter in to the next activity. plz tell me sol of this prolem

    Reply
  30. Hello Sir, I tried above code any for registration it works perfectly but for login part when i’m testing it on postman and giving username and password parameter its showing invalid username and password , though its right its giving same error for all registered user so can you tell me what is the error in login.php?please….

    Reply
  31. Thank you so much for the detailed instructions. Its useful as the source code is embedded in your tutorial so that we can try ourself.
    Please keep doing such great works.. Hats off sir

    Reply
  32. Everything is working perfect except getID. SIr please add this code. You have left it undone …I took source code from this page itself. Please look into this sir

    Reply
  33. hey i got message login successful but it doesnt go to next activity ….
    i used fname instead of username everywhere
    help please

    i got this…

    W/System.err: org.json.JSONException: No value for fname
    W/System.err: at org.json.JSONObject.get(JSONObject.java:392)
    at org.json.JSONObject.getString(JSONObject.java:553)
    W/System.err: at com.example.ok.LoginActivity$1UserLogin.onPostExecute(LoginActivity.java:134)
    at com.example.ok.LoginActivity$1UserLogin.onPostExecute(LoginActivity.java:107)
    at android.os.AsyncTask.finish(AsyncTask.java:695)
    at android.os.AsyncTask.-wrap1(Unknown Source:0)
    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:712)

    Reply
  34. i’m posting all parameters with ResTer Client on firefox but i still ge this response

    {“error”:true,”message”:”required parameters are not available”}

    Reply
  35. Getting a log error
    W/System.err: org.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject
    never writes to database

    Reply
  36. i got this message {“error”:true,”message”:”Invalid API Call”} when run api.php file.when try to run project only login and sign up page show nothing activity happen next no registration no login

    Reply
  37. Hi Belal ,

    Very nicely explained. It helped me a lot. I need a small help. I am able to update and read the database using method explained above. I need a small help.

    I am trying to read multiple records/rows from the database and then trying to display them on listview.

    I have added another switch case in the SQL API. However my query will be returning multiple rows. I am wondering how can i receive multiple rows in the app and then display them

    $stmt = $conn->prepare(“SELECT col1,col2 FROM my_tableWHERE col3 = ? “);
    $stmt->bind_param(“s”,$col3);
    $stmt->execute();
    $stmt->bind_result($col1, $col2);
    $stmt->fetch();
    $user = array(
    ‘col1’=>$col1,
    ‘col2’=>$col2
    );

    Reply
  38. Niceeeeee work. but i have a little Problem.

    i have delete the “Gender” lines and all works good but in the Profile Page schows me now the Username the Email Adress instead Username and instead my Email shows me the md5 Password.

    Wehre must i look to fix this

    Reply
  39. It’s good but, DbConnect.php file how safe to public? the file show username and password.
    Please make a video, How to make 405 error and 403 error in xampp server.

    Reply

Leave a Comment