Android PHP Mysql login tutorial using HttpURLConnection


Table ‘tbl_login’ contains username and password of user.

Table holds data row like this.


  1. include file to connect database.
  2. Check if POST data is set from android.
  3. Query the database to see row exist or not.
  4. Return the result.


The image on the top of page shows both and respectively.

  1. On LogIn button click checkLogin() function is triggered. Which innitiate AsyncLogin class to carry out Asynchronous task.
  2. onPreExecute(), invoked on the UI thread before the task is executed. Here We are displaying loading message.
  3. doInBackground(Params…), invoked on the background thread immediately after
    onPreExecute() finishes executing. The sending and recieving data from and to php file using HttpURLConnection class has done in this function.
  4. onPostExecute(Result), invoked on the UI thread after the background computation finishes. Here we are checking for recieved result.
  5. The parameters params[0] and params[1] is from AsyncLogin’s execute method.


The xml file for

This Activity is launched from onPreExecute() method after login success.


The xml file for


Don’t forget to add uses-permission and SuccessActivity to your AndroidManifest.xml file.

Android PHP Mysql login tutorial using HttpURLConnection

5 سال پیش

دیدگاهتان را بنویسید

نشانی ایمیل شما منتشر نخواهد شد. بخش‌های موردنیاز علامت‌گذاری شده‌اند *

این سایت از اکیسمت برای کاهش هرزنامه استفاده می کند. بیاموزید که چگونه اطلاعات دیدگاه های شما پردازش می‌شوند.