Android PHP MySQL Login Tutorial


Yong Loon Ng

Ng Yong Loon, better known as Kristofer is a software engineer and computer scientist who doubles up as an entrepreneur.

You may also like...

30 Responses

  1. DF says:

    if i insert your code into my android studio the app on my phone opens, and i can enter a password and user name. but when i press the login button the app closess on my phone

  2. Kristofer Ng says:

    did you download xampp to setup your web server?

  3. jane says:

    hey hi,
    I’m getting SocketTimeoutException: timeout. I’m running the app on nexus device.
    But if I try to put the url in the browser open up to show connected.
    Can you help ?

    • Kristofer Ng says:

      url = new URL(“http://localhost/php-android-login/login.php”);
      for the url “localhost” change to your local ip address,
      it should be work.

      you can check your local ip address via command prompt by typing “ipconfig”

  4. virat says:

    When I run the code, I get this null pointer in the logcat file :

    java.lang.NullPointerException: Attempt to invoke virtual method ‘android.content.res.Resource&Theme android.content,Context.getTheme()’ c

    How to rectify this?

  5. david says:

    HI, that for the guide.
    getting error as follow:
    java.lang.NullPointerException: Attempt to invoke virtual method ‘android.content.res.Resources$Theme android.content.Context.getTheme()’ on a null object reference

    crash upon clicking login button.
    Using Wammp server. i able to connect through android phone with other project.
    How to solve this?

  6. Rulillada says:

    url = new URL(“http://iplocal:8000/php-android-login/login.php”);
    networkstate and internet permissions

  7. Rulillada says:

    private LoginActivity loginActivity;
    private ProgressDialog pdLoading; ——-)))))))
    private HttpURLConnection conn;
    private URL url = null;

    public AsyncLogin(LoginActivity loginActivity) {
    this.loginActivity = loginActivity;

    protected void onPreExecute() {
    pdLoading = new ProgressDialog(loginActivity); —-))))))) here
    //this method will be running on UI thread


  8. Pieter Du Toit says:

    I created an APK file and installed on my phone. It goes directly to login successful without displaying the login page

  9. Jay says:

    Put the source code and we will download

  10. zaid says:

    where code?

  11. Pablo says:

    i got problems with ProgressDialog it dosen’t work in
    ProgressDialog pd = new ProgressDialog(loginActivity);

  12. I have sendUserActionEvent() mView == null ………error

  13. Appoorve says:

    I have a query… I hd not followed your code bt approached in some other way and getting registration success toast but there is no data available in the database

  14. Appoorve says:

    If u r interested to help me out…. Then I should send u the screenshots

  15. Jessica says:

    Hi, just want to comment a typo, you named your database as ‘androiddb’ at the beginning of the post but then you put ‘login’ as your database name in config.php

  16. Zakir Khan says:

    i got the message as application stopped working

  17. Only about a week to ten days ago, we spent an hour and a half together talking about his dreams for Lebanon and for a peaceful Middle East.

  18. I’ve been browsing online greater than three hours as of
    late, but I never found any fascinating article like yours.

    It’s beautiful value sufficient for me. In my view, if all web owners and bloggers made just right content material as
    you probably did, the web will be a lot more useful than ever

  19. Muhammad says:

    This helped alot thanks.

  20. Mozeago says:

    I have tried to grasp this concept from top devs but I couldn’t, all I get was errors am Happy your code worked pretty well, Good work,Keep up. Can you kindly do one on taking a photo and saving it locally to phone using sqlite database. Item, description and image (saved locally).

  21. mywebsite says:

    Thanks designed for sharing such a good opinion,
    paragraph is nice, thats why i have read it entirely

Leave a Reply

Your email address will not be published. Required fields are marked *