Android Login and Registration With PHP, MySQL and SQLite
Comments
Description
Downloads HOME HTTP Tips Write for Us SEARCH HERE Android Login and Registration with PHP, MySQL and SQLite Android Login and Registration with PHP, MySQL and SQLite Search the site by Ravi Tamada / January 31, 2012 / 3479 Comments VIDEO DEMO In my previous article Android Login and Registration Screen Design I explained designing the login and registration interfaces. But it has no real time functionality. In this tutorial I am going to explain how to build complete login and registration system in android using PHP, MySQL and SQLite. Also this tutorial covers how to build simple API using PHP and MySQL. WE’RE SOCIAL DOWNLOAD CODE AndroidHive 40,056 likes Like Page Be the first of your friends to like this Subscribe to Newsletter Join our 746,498 subscribers and get access to the latest android tutorials, freebies, scripts and much more! Email Sign Up We strictly care about your privacy! Android Login and Registration with PHP, MySQL and SQLite ... Below are the 㜀㌀nal outputs of this project. Prerequisites This tutorial is combination of few of my previous articles. Make sure you went through the below articles if you are very beginner. 1. Android working with Volley Library – Used to make HTTP calls. 2. Android Login and Registration Screen Design – Explained the designing of Login and Registration screens. API (Application Programming Interface) POPULAR ANDROID TUTORIALS 1. Android SQLite Database Tutorial - 1,481,850 views 2. How to connect Android with PHP, MySQL - 1,465,110 views 3. Android JSON Parsing Tutorial - 1,319,838 views 4. Android Push Noti㜀㌀cations using Google Cloud Messaging (GCM), PHP and MySQL - 1,241,454 views 5. Android Sliding Menu using Navigation Drawer 1,155,512 views 6. Android Login and Registration with PHP, MySQL and SQLite 1,017,172 views 7. Android Custom ListView with Image and Text 1,003,089 views 8. Android GPS, Location Manager Tutorial - 779,557 views 9. Android Tab Layout with Swipeable Views - 720,129 views 10. Android working with Google Maps V2 - 638,662 views To interact with MySQL database we need to build a REST API 㜀㌀rst. REST Api job is to get the request from client, interact with database and 㜀㌀nally give the response back to client. So we’ll create a simple PHP, MySQL API 㜀㌀rst. Our API do’s below jobs. ⇒ Accepts requests in GET/POST methods ⇒ Interact with database by inserting / fetching data. ⇒ Finally will give response back in JSON format 1. Downloading & Installing WAMP Download & Install WAMP server from www.wampserver.com/en/. Once installed, launch the program from Start ⇒ All Programs ⇒ WampServer ⇒ StartWampServer. If you are on Mac, alternatively you can use MAMP for the same. You can test your server by opening the address http://localhost/ in your browser. Also you can check phpmyadmin by opening http://localhost/phpmyadmin Following is a screencast of Downloading and Installing WAMP Server. email varchar(100) not null unique. name varchar(50) not null. updated_at datetime null ). .Downloading and Installing WAMP Server 2. The default installation location of wamp would be C:/wamp. unique_id varchar(23) not null unique. salt varchar(10) not null. create database android_api /** Creating Database **/ use android_api /** Selecting Database **/ create table users( id int(11) primary key auto_increment. created_at datetime. Below is the 㜀㌀nal PHP project structure we are going to create in this article. Creating PHP Project Goto the location where wamp installed and open www folder. /** Creating Users Table **/ 3. encrypted_password varchar(80) not null. Creating MySQL Database and Tables Open phpmyadmin and execute below queries to create necessary database and table. Here we are creating only one table users to store users login information. Config.php inside include with below content. 2. . Go into www folder and create a folder named android_login_api.php and add below content. This 㜀㌀le contains functions to store user in database. DB_Connect. we keep all the helper classes.php in include and paste below code.php <?php class DB_Connect { private $conn. ?> 4. DB_USER. "localhost"). delete user. // return database handler return $this‐>conn. DB_DATABASE).php'. 3. You can also add methods like update user. DB_PASSWORD. In android_login_api.1. Create DB_Functons. create a php 㜀㌀le named Con㜀㌀g. define("DB_DATABASE". define("DB_PASSWORD". "android_api"). // Connecting to database public function connect() { require_once 'include/Config. get user from database. } } ?> 5. Now inside include. create another directory named include. In this folder.php <?php /** * Database config variables */ define("DB_HOST". "root"). Replace the DB_USER and DB_PASSWORD values with your’s. This will be the root directory of our project. "root"). Create a class named DB_Connect. In this class we handle opening and closing of database connection. define("DB_USER". // Connecting to mysql database $this‐>conn = new mysqli(DB_HOST. androidhive. $password) { $uuid = uniqid(''. email. } else { return false. $uuid. return $user. $stmt‐>close(). $password $stmt = $this‐>conn‐>prepare("SELECT * FROM users WHERE email = ?" $stmt‐>bind_param("s". $stmt‐>close(). $name. true). // check for successful store if ($result) { $stmt = $this‐>conn‐>prepare("SELECT * FROM users WHERE email = ?" $stmt‐>bind_param("s". $email.php'. $email.info/2012/01/android‐login‐and‐registration‐with‐php‐mysql‐a */ class DB_Functions { private $conn. Sample user id will be like 4f074eca601fb8. encrypted_pa $stmt‐>bind_param("sssss". $hash = $this‐>hashSSHA($password). } } /** * Get user by email and password */ public function getUserByEmailAndPassword($email. Each password needs two columns to store it in database.88015924 Encrypted Password – The passwords are stored using base64_encode method. // verifying user password $salt = $user['salt']. if ($stmt‐>execute()) { $user = $stmt‐>get_result()‐>fetch_assoc(). // constructor function __construct() { require_once 'DB_Connect. $stmt‐>close(). $email). . $user = $stmt‐>get_result()‐>fetch_assoc(). <?php /** * @author Ravi Tamada * @link http://www. true) function. $encrypted_password $result = $stmt‐>execute(). // salt $stmt = $this‐>conn‐>prepare("INSERT INTO users(unique_id. // encrypted password $salt = $hash["salt"]. $email). One is to store encrypted password and other is to store salt used to encrypt the password. $stmt‐>execute().unique id – I am generating unique user id in php using uniqid(”. $encrypted_password = $hash["encrypted"]. $this‐>conn = $db‐>connect(). name. // connecting to database $db = new Db_Connect(). } // destructor function __destruct() { } /** * Storing new user * returns user details */ public function storeUser($name. $stmt‐>store_result(). create register. $password) { $hash = base64_encode(sha1($password . } } else { return NULL. true) . if ($stmt‐>num_rows > 0) { // user existed $stmt‐>close(). 6. } } /** * Encrypting password * @param password * returns salt and encrypted password */ public function hashSSHA($password) { $salt = sha1(rand()).php and below code. In android_login_api root directory. 0. $salt. // check for password equality if ($encrypted_password == $hash) { // user authentication details are correct return $user. Let’s start creating the endpoint for user registration. return true. } /** * Decrypting password * @param salt. 10). $stmt‐>execute(). $encrypted = base64_encode(sha1($password . } } ?> 3. $salt return $hash. } else { // user not existed $stmt‐>close(). $hash = array("salt" => $salt. $encrypted_password = $user['encrypted_password']. $email).1 Registration Endpoint Now we have all the required classes ready. This endpoint accepts name. } } /** * Check user is existed or not */ public function isUserExisted($email) { $stmt = $this‐>conn‐>prepare("SELECT email from users WHERE email = ?" $stmt‐>bind_param("s". $salt = substr($salt. $salt. $hash = $this‐>checkhashSSHA($salt. $password). true) . "encrypted" => $encrypted return $hash. email and password as PO ST parameters and store the user in MySQL database. return false. . password * returns hash string */ public function checkhashSSHA($salt. php <?php require_once 'include/DB_Functions. echo json_encode($response).2 Login Endpoint Just like registration. // json response array $response = array("error" => FALSE). $response["error_msg"] = "Unknown error occurred in registration!" echo json_encode($response). $response["user"]["name"] = $user["name"]. email or password) is missing!" echo json_encode($response). } ?> 3. $db = new DB_Functions(). // check if user is already existed with the same email if ($db‐>isUserExisted($email)) { // user already existed $response["error"] = TRUE. Create a php 㜀㌀le named login. $response["user"]["created_at"] = $user["created_at" $response["user"]["updated_at"] = $user["updated_at" echo json_encode($response). 7. $response["error_msg"] = "Required parameters (name. } else { // user failed to store $response["error"] = TRUE. if (isset($_POST['name']) && isset($_POST['email']) && isset($_POST // receiving the post params $name = $_POST['name']. it checks in database for matched user. it echoes the success the json response.php inside android_login_api with the below content. $response["user"]["email"] = $user["email"]. // json response array $response = array("error" => FALSE). we need to create another endpoint for login. $response["uid"] = $user["unique_id"]. } else { // create a new user $user = $db‐>storeUser($name. if ($user) { // user stored successfully $response["error"] = FALSE. if (isset($_POST['email']) && isset($_POST['password'])) { .php'. login.php <?php require_once 'include/DB_Functions. } } } else { $response["error"] = TRUE. This endpoint accepts email and password as POST parameters. $password = $_POST['password']. $db = new DB_Functions(). If the user is matched. After receiving the email and password. $email = $_POST['email']. $response["error_msg"] = "User already existed with " . $email.php'.register. $password). $response["user"]["name"] = $user["name"]. // receiving the post params $email = $_POST['email'].info". $response["user"]["created_at"] = $user["created_at"]. // get the user by email and password $user = $db‐>getUserByEmailAndPassword($email. email. $response["user"]["updated_at"] = $user["updated_at"]. "user": { "name": "Ravi Tamada". $response["user"]["email"] = $user["email"]. if ($user != false) { // use is found $response["error"] = FALSE. $response["uid"] = $user["unique_id"]. 3. $response["error_msg"] = "Required parameters email or password is missing!" echo json_encode($response). } else { // user is not found with the credentials $response["error"] = TRUE.3 Types of JSON Responses The following are the di爀漀erent types of JSON responses for registration and login endpoints.php PARAMS: name. Please try again!" echo json_encode($response). "updated_at": null } } Registration error in storing { "error": 1. $response["error_msg"] = "Login credentials are wrong. } ?> 3. password Registration success response { "error": false. } } else { // required post params is missing $response["error"] = TRUE.1 Registration URL: http://localhost/android_login_api/register. "email": "ravi@androidhive. $password).50984590". "created_at": "2015‐09‐17 13:26:16". $password = $_POST['password']. echo json_encode($response). "uid": "55fa7220a2c187.3. "error_msg": "Unknown error occurred in registration!" } Registration error – User Already Existed . 50984590". In Android Studio.android. "error_msg": "User already existed with ravi8x@androidhive. "error": 2.0.0 . 3.info". "uid": "55fa7220a2c187.mc x i a ok e.support:appcompat‐v7:23.volley:library‐aar:1.{ "success": 0. create a new project from File ⇒ New Project and 㜀㌀ll all the required details. 1. Open build. "error_msg": "Login credentials are incorrect.v ol l ey: li br ar y-a a r:1 . Registration Screen and a welcome Dashboard Screen.1' compile 'com.info" } 3. Please try again!" } Now we have completed the PHP part. "email": "ravi@androidhive. "updated_at": null } } Login error – Incorrect username / password { "tag": "login".2 Login URL: http://localhost/android_login_api/login. 2. build. "error": 1.php PARAMS: email.gradle dependencies { compile 'com. "success": 0.1' compile 'com.android. "user": { "name": "Ravi Tamada".1.3. "created_at": "2015‐09‐17 13:26:16". Let’s start the android part. Creating the Android Project The app we’re gonna build will have three simple screens Login Screen. Create three packages named app. password Login Success { "error": false. activity and helper under src folder.gradle and add volley library support by adding comp i l e ‘ com.0 ’ under dependencies. 4.mcxiaoke.support:design:23.0' .1. app.168. In this class we declare the login and registration urls.java package info.102/android_login_api/login. strings. While testing you need to replace the ip address with your localhost pc ip.loginandregistration. public class AppConfig { // Server user login url public static String URL_LOGIN = "http://192. Open strings.168.php // Server user register url public static String URL_REGISTER = "http://192.xml. create a new 㜀㌀le with the name.} 4. Under app package create a class named AppCon㜀㌀g. If you don’t 㜀㌀nd colors. Open colors.0" encoding="utf‐8"?> <resources> <color name="bg_login">#26ae90</color> <color name="bg_register">#2e3237</color> <color name="bg_main">#428bca</color> <color name="white">#ffffff</color> <color name="input_login">#222222</color> <color name="input_login_hint">#999999</color> <color name="input_register">#888888</color> <color name="input_register_bg">#3b4148</color> <color name="input_register_hint">#5e6266</color> <color name="btn_login">#26ae90</color> <color name="btn_login_bg">#eceef1</color> <color name="lbl_name">#333333</color> <color name="btn_logut_bg">#ff6861</color> </resources> 6. AppConfig.androidhive.0.</ <string name="welcome">Welcome</string> <string name="btn_logout">LOGOUT</string> <string name="name">Fullname</string> </resources> 5.php } .0.xml <?xml version="1.xml located under res ⇒ values and add below string values.xml located under res ⇒ values and add the color values.0" encoding="utf‐8"?> <resources> <string name="app_name">Android Login and Registration</string <string name="hint_email">Email</string> <string name="hint_password">Password</string> <string name="hint_name">Fullname</string> <string name="btn_login">LOGIN</string> <string name="btn_register">REGISTER</string> <string name="btn_link_to_register">Not a member? Sign up now.102/android_login_api/register. colors.</ <string name="btn_link_to_login">Already registred! Login Me.java and add below code.xml <?xml version="1. private static AppController mInstance.android. getRequestQueue().getSimpleName(). Also add other activities (LoginActivity.android.androidhive. Now open AndroidManifest. Add the AppController class to <application> tag. String tag) { req.xml <?xml version="1.Volley. RegisterActivity and MainActivity) which we are going to create shortly. AndroidManifest. } public void cancelPendingRequests(Object tag) { if (mRequestQueue != null) { mRequestQueue. } } } 8. } public static synchronized AppController getInstance() { return mInstance. import android.android.setTag(TAG). } public RequestQueue getRequestQueue() { if (mRequestQueue == null) { mRequestQueue = Volley. In this class we initiate all the volley core objects. import android.app.class.7. } public <T> void addToRequestQueue(Request<T> req) { req.add(req). I am keeping LoginActivity as launcher activity as it should be seen on app launch.isEmpty(tag) ? TAG : tag). import com. import com. mInstance = this.text. getRequestQueue().volley. AppController.Application.app.java. create a class named AppController.newRequestQueue(getApplicationContext()).add(req).xml and add IN T ERN ET permission.volley. private RequestQueue mRequestQueue.androidhive.android.TextUtils. This class extends from Appl i c at io n which should be executed on app launch.setTag(TextUtils.loginandregistration" android:versionCode="1" .com/apk/res/android package="info. } return mRequestQueue.cancelAll(tag). public class AppController extends Application { public static final String TAG = AppController.java package info.Request.volley. import com.toolbox. @Override public void onCreate() { super. Under app package. } public <T> void addToRequestQueue(Request<T> req.0" encoding="utf‐8"?> <manifest xmlns:android="http://schemas.loginandregistration.RequestQueue.onCreate(). SessionManager. My previous article Android User Session Management using Shared Preferences gives you a good overview of managing the session data using SharedPreferences.androidhive.intent.loginandregistration.LoginActivity" android:label="@string/app_name" android:launchMode="singleTop" android:windowSoftInputMode="adjustPan" > <intent‐filter> <action android:name="android.MainActivity" android:label="@string/app_name" android:launchMode="singleTop" /> </application> </manifest> 9.getSimpleName().RegisterActivity" android:label="@string/app_name" android:launchMode="singleTop" android:windowSoftInputMode="adjustPan" /> <activity android:name=". import android.content.Editor.intent. // Shared preferences file name private static final String PREF_NAME = "AndroidHiveLogin". This class maintains session data across the app using the SharedPreferences.content.0" > <uses‐sdk android:minSdkVersion="9" android:targetSdkVersion="21" /> <uses‐permission android:name="android. android:versionName="1.MAIN" <category android:name="android. create a class named SessionManager.class.SharedPreferences. Editor editor.java package info. public class SessionManager { // LogCat tag private static String TAG = SessionManager.permission. We store a boolean 㐀㨀ag is Lo gged In in shared preferences to check the login status. // Shared Preferences SharedPreferences pref.androidhive. . import android.LAUNCHER" </intent‐filter> </activity> <activity android:name=". Under helper package.INTERNET" <application android:name="info. import android.helper. Context _context. // Shared pref mode int PRIVATE_MODE = 0. import android.content.loginandregistration.app.Context.util.Log.java and add below code.SharedPreferences.AppController" android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name=".category.action. ContentValues. } } 10. private static final String KEY_NAME = "name". PRIVATE_MODE). private static final String KEY_UID = "uid".database. null. import android.getBoolean(KEY_IS_LOGGEDIN.database.Context. Whenever we needs to get the logged in user information. SQLiteHandler. pref = _context.java and paste the below code.java /** * Author: Ravi Tamada * URL: www.getSimpleName().HashMap.com/ravitamada * */ package info.content. // Login table name private static final String TABLE_USER = "user". // All Static variables // Database Version private static final int DATABASE_VERSION = 1. } .class._context = context. // Login Table Columns names private static final String KEY_ID = "id".info * twitter: http://twitter. This class takes care of storing the user data in SQLite database. import android. "User login session modified!"). Log. import java. import android. private static final String KEY_IS_LOGGEDIN = "isLoggedIn". // Database Name private static final String DATABASE_NAME = "android_api".sqlite. private static final String KEY_EMAIL = "email".putBoolean(KEY_IS_LOGGEDIN. isLoggedIn).SQLiteDatabase. private static final String KEY_CREATED_AT = "created_at".loginandregistration. // commit changes editor.Cursor. DATABASE_VERSION).commit().content. public SessionManager(Context context) { this.util. import android.database. import android. import android.getSharedPreferences(PREF_NAME.Log.helper. DATABASE_NAME. we fetch from SQLite instead of making request to server. } public boolean isLoggedIn(){ return pref.sqlite.edit().d(TAG. public class SQLiteHandler extends SQLiteOpenHelper { private static final String TAG = SQLiteHandler. } public void setLogin(boolean isLoggedIn) { editor.androidhive.util. false). create a class named SQLiteHandler.androidhive. editor = pref.SQLiteOpenHelper. public SQLiteHandler(Context context) { super(context. Under helper package. put("name". null. } .d(TAG. Cursor cursor = db.execSQL("DROP TABLE IF EXISTS " + TABLE_USER). String>(). user. created_at). } /** * Getting user data from database * */ public HashMap<String. } // Upgrading database @Override public void onUpgrade(SQLiteDatabase db. if (cursor. // Email values. // Create tables again onCreate(db). db.insert(TABLE_USER. name).put("created_at". String> getUserDetails() { HashMap<String.getWritableDatabase(). String> user = new HashMap<String. "New user inserted into sqlite: " + id).put(KEY_EMAIL.rawQuery(selectQuery. cursor. // Delete All Rows db. // Created At // Inserting Row long id = db. "Deleted all user info from sqlite").put(KEY_CREATED_AT.d(TAG. null). String email.close(). int oldVersion.put("email". // Closing database connection Log. email). cursor.close(). Log. String selectQuery = "SELECT * FROM " + TABLE_USER. String created_at) { SQLiteDatabase db = this.put(KEY_NAME. "Fetching user from Sqlite: " + user. Log.getWritableDatabase().getString(4)). // Name values." + KEY_NAME + + KEY_EMAIL + " TEXT UNIQUE. null. String uid.put("uid". values).delete(TABLE_USER.getCount() > 0) { user. cursor.close(). SQLiteDatabase db = this. // return user Log. cursor. values.getString(3)). null). ContentValues values = new ContentValues().getString(1)).getString(2)). db. uid). db. } cursor. int // Drop older table if existed db. } /** * Storing user details in database * */ public void addUser(String name. "Database tables created"). // Email values. } /** * Re crate database Delete all tables and create them again * */ public void deleteUsers() { SQLiteDatabase db = this.close(). // Creating Tables @Override public void onCreate(SQLiteDatabase db) { String CREATE_LOGIN_TABLE = "CREATE TABLE " + TABLE_USER + + KEY_ID + " INTEGER PRIMARY KEY. db.moveToFirst(). user.getReadableDatabase()." + KEY_UID + " TEXT. user. // Move to first row cursor.d(TAG.d(TAG. return user.put(KEY_UID.toString()).execSQL(CREATE_LOGIN_TABLE)." + KEY_CREATED_AT + " TEXT" + ")". 11.xml under res ⇒ layout. mysql server.0" encoding="utf‐8"?> <LinearLayout xmlns:android="http://schemas.} 4.xml <?xml version="1. activity_login.android. Create an xml 㜀㌀le named activity_login.com/apk/res/android android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/bg_login" android:gravity="center" android:orientation="vertical" android:padding="10dp" > <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:orientation="vertical" android:paddingLeft="20dp" android:paddingRight="20dp" > <EditText android:id="@+id/email" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:background="@color/white" android:hint="@string/hint_email" android:inputType="textEmailAddress" android:padding="10dp" android:singleLine="true" android:textColor="@color/input_login" android:textColorHint="@color/input_login_hint" /> <EditText android:id="@+id/password" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:background="@color/white" android:hint="@string/hint_password" android:inputType="textPassword" android:padding="10dp" android:singleLine="true" android:textColor="@color/input_login" android:textColorHint="@color/input_login_hint" /> <!‐‐ Login Button ‐‐> .1 Adding the Login Screen Now we’ll implement the login module by creating the screen and adding the code to make login request to php. getSimpleName().HashMap.com/ravitamada */ package info.widget. private EditText inputEmail.loginandregistration.java under activity package.Method.widget.androidhive. import org.volley.widget.util.androidhive.loginandregistration.json.view. LoginActivity.SessionManager.os. private Button btnLinkToRegister. Create an activity class named LoginActivity. import com.Request.app.ProgressDialog.R. import com.volley.loginandregistration. import com. import info.Log.util.util.android.info * twitter: http://twitter. import android.SQLiteHandler. import android. import android.java /** * Author: Ravi Tamada * URL: www.json.android.VolleyError.volley. import android.content. import java. import info. import info.class.Activity. import android.activity. import info.app.Map.loginandregistration.AppController.Intent. import android.app.loginandregistration.Button. import java.AppConfig. import org.androidhive. <Button android:id="@+id/btnLogin" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="20dip" android:background="@color/btn_login_bg" android:text="@string/btn_login" android:textColor="@color/btn_login" /> <!‐‐ Link to Login Screen ‐‐> <Button android:id="@+id/btnLinkToRegisterScreen" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="40dip" android:background="@null" android:text="@string/btn_link_to_register" android:textAllCaps="false" android:textColor="@color/white" android:textSize="15dp" /> </LinearLayout> </LinearLayout> 12.loginandregistration.android.StringRequest.app.androidhive.volley.androidhive. import android. In this class che ckLo g i n( ) – Method veri㜀㌀es the login details on the server by making the volley http request. import info.androidhive. public class LoginActivity extends Activity { private static final String TAG = RegisterActivity.android.helper. private Button btnLogin. import android.Bundle. import android.JSONObject.View. import com.Response.EditText.Toast.JSONException.toolbox.helper. .androidhive. startActivity(i). } // Login button Click Event btnLogin.OnClickListener() { public void onClick(View view) { String email = inputEmail. } } }). // Check if user is already logged in or not if (session. showDialog().layout.activity_login). // Session manager session = new SessionManager(getApplicationContext()).POST. startActivity(intent). final String password) { // Tag used to cancel the request String tag_string_req = "req_login". btnLinkToRegister = (Button) findViewById(R. } /** * function to verify login details in mysql db * */ private void checkLogin(final String email. btnLogin = (Button) findViewById(R..OnClickListener() { public void onClick(View view) { Intent i = new Intent(getApplicationContext().LENGTH_LONG) .id.onCreate(savedInstanceState). // Progress dialog pDialog = new ProgressDialog(this).trim()."). setContentView(R.setOnClickListener(new View.. Toast.id. StringRequest strReq = new StringRequest(Method. private SessionManager session. String password = inputPassword. private SQLiteHandler db. } }).setOnClickListener(new View. private ProgressDialog pDialog. // Link to Register Screen btnLinkToRegister. password).getText(). pDialog.getText().id. // SQLite database handler db = new SQLiteHandler(getApplicationContext()). MainActivity.makeText(getApplicationContext(). "Please enter the credentials!".show().trim(). } else { // Prompt user to enter credentials Toast.toString(). @Override public void onCreate(Bundle savedInstanceState) { super. finish().setMessage("Logging in .class). RegisterActivity. Take him to main activity Intent intent = new Intent(LoginActivity.isEmpty() && !password. private EditText inputPassword.isEmpty()) { // login user checkLogin(email. // Check for empty data in the form if (!email. finish().toString().btnLinkToRegisterScreen). .isLoggedIn()) { // User is already logged in.email).setCancelable(false).btnLogin).password). inputEmail = (EditText) findViewById(R.this. pDialog.id. inputPassword = (EditText) findViewById(R. getString("created_at").put("password".getMessage()).isShowing()) pDialog. finish(). new Response. boolean error = jObj.put("email".getString("email"). try { JSONObject jObj = new JSONObject(response).setLogin(true).toString()). // Now store the user in SQLite String uid = jObj. startActivity(intent). "Login Response: " + response. "Login Error: " + error. // Inserting row in users table db. password). } else { // Error in login.makeText(getApplicationContext(). "Json error: " } } }. new Response.show(). String>(). error. Toast. hideDialog(). } } catch (JSONException e) { // JSON error e.getMessage().Listener<String>() { @Override public void onResponse(String response) { Log. JSONObject user = jObj. String email = user.e(TAG. Toast. String> getParams() { // Posting parameters to login url Map<String. errorMsg.addToRequestQueue(strReq.getString("uid").ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Log.show(). } .makeText(getApplicationContext().getInstance().getString("name"). } }) { @Override protected Map<String. Toast.show(). } private void showDialog() { if (!pDialog.getString("error_msg" Toast.LENGTH_LONG).URL_LOGIN. Get the error message String errorMsg = jObj. tag_string_req). // Check for error node in json if (!error) { // user successfully logged in // Create login session session.getJSONObject("user" String name = user. uid.class). String created_at = user .printStackTrace(). String> params = new HashMap<String. } }. // Launch main activity Intent intent = new Intent(LoginActivity. Toast. params. email. // Adding request to request queue AppController.addUser(name. hideDialog(). email).d(TAG.getBoolean("error").LENGTH_LONG). AppConfig. MainActivity. params.makeText(getApplicationContext(). created_at). return params. xml <?xml version="1.0" encoding="utf‐8"?> <LinearLayout xmlns:android="http://schemas. activity_register. you should see the login screen.android.1 Adding the Registration Screen 13. Create an xml layout named activity_register. But login might not work as we don’t have any user information in mysql database. } } Now if you run the app. private void hideDialog() { if (pDialog.com/apk/res/android android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/bg_register" android:gravity="center" android:orientation="vertical" android:padding="10dp" > <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:orientation="vertical" android:paddingLeft="20dp" .xml under res ⇒ layout. That can be done by adding the registration screen. 4.dismiss().isShowing()) pDialog. Create an activity class named RegisterActivity. . android:paddingRight="20dp" > <EditText android:id="@+id/name" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:background="@color/input_register_bg" android:hint="@string/hint_name" android:padding="10dp" android:singleLine="true" android:inputType="textCapWords" android:textColor="@color/input_register" android:textColorHint="@color/input_register_hint" <EditText android:id="@+id/email" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:background="@color/input_register_bg" android:hint="@string/hint_email" android:inputType="textEmailAddress" android:padding="10dp" android:singleLine="true" android:textColor="@color/input_register" android:textColorHint="@color/input_register_hint" <EditText android:id="@+id/password" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:background="@color/input_register_bg" android:hint="@string/hint_password" android:inputType="textPassword" android:padding="10dp" android:singleLine="true" android:textColor="@color/input_register" android:textColorHint="@color/input_register_hint" <!‐‐ Login Button ‐‐> <Button android:id="@+id/btnRegister" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="20dip" android:background="#ea4c88" android:text="@string/btn_register" android:textColor="@color/white" /> <!‐‐ Link to Login Screen ‐‐> <Button android:id="@+id/btnLinkToLoginScreen" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="40dip" android:background="@null" android:text="@string/btn_link_to_login" android:textAllCaps="false" android:textColor="@color/white" android:textSize="15dp" /> </LinearLayout> </LinearLayout> 14.java under activity package. reg i s t er U s er( ) – Will store the user by passing name.mysql server. email and password to php. util.activity.androidhive.androidhive.btnRegister).this. btnLinkToLogin = (Button) findViewById(R. @Override public void onCreate(Bundle savedInstanceState) { super. import info. btnRegister = (Button) findViewById(R.password).class).android.androidhive. import android.helper.Bundle.db.content. private EditText inputPassword.Response. import android.StringRequest.android.androidhive. import com.layout. public class RegisterActivity extends Activity { private static final String TAG = RegisterActivity.loginandregistration.app.json.json.id.loginandregistration.widget.androidhive.id. import com. Take him to main activity Intent intent = new Intent(RegisterActivity. import org.JSONObject.VolleyError.os.name). import android.JSONException.AppController. // SQLite database handler db = new SQLiteHandler(getApplicationContext()).btnLinkToLoginScreen). .info * twitter: http://twitter. import android.util. private SessionManager session.loginandregistration.setCancelable(false).email). MainActivity. import java.android.class.widget.getSimpleName(). private Button btnLinkToLogin.id.Request.Method.isLoggedIn()) { // User is already logged in. pDialog. import android.Toast. import com. import android. import android.app.androidhive. import android.id.toolbox.SessionManager. import info. RegisterActivity. private ProgressDialog pDialog.app. // Progress dialog pDialog = new ProgressDialog(this). import info. inputPassword = (EditText) findViewById(R. // Check if user is already logged in or not if (session.volley. private EditText inputFullName. startActivity(intent).ProgressDialog.View.helper. setContentView(R.loginandregistration.Map.util.onCreate(savedInstanceState).loginandregistration.Intent. inputFullName = (EditText) findViewById(R. import java. private Button btnRegister. import android.Log.app.Activity. private SQLiteHandler db. import com.id.androidhive.java /** * Author: Ravi Tamada * URL: www. import org.SQLiteHandler.volley. ad dUs er( ) – Will insert the user in SQLite database once he is successfully registered.com/ravitamada */ package info.R.android.loginandregistration.view. import info.EditText. // Session manager session = new SessionManager(getApplicationContext()). inputEmail = (EditText) findViewById(R.HashMap.volley.volley.Button. private EditText inputEmail.activity_register).AppConfig. import info.widget. getString("created_at").URL_REGISTER.LENGTH_LONG) .getString("name")..class).toString()).getText(). StringRequest strReq = new StringRequest(Method.toString().trim().POST.trim(). "Please enter your details!". email. finish(). String created_at = user .getText(). Toast.makeText(getApplicationContext().setMessage("Registering . } }). String password = inputPassword. pDialog. if (!error) { // User successfully stored in MySQL // Now store the user in sqlite String uid = jObj. final String password) { // Tag used to cancel the request String tag_string_req = "req_register". finish(). Toast. try { JSONObject jObj = new JSONObject(response). LoginActivity. finish(). showDialog(). created_at).. } // Register Button Click event btnRegister.OnClickListener() { public void onClick(View view) { Intent i = new Intent(getApplicationContext(). email. .getText(). // Inserting row in users table db. final String email. boolean error = jObj.d(TAG. } else { Toast.").toString(). AppConfig.isEmpty() && !password. String email = user. password). startActivity(i).setOnClickListener(new View.getString("uid").OnClickListener() { public void onClick(View view) { String name = inputFullName. } } }). * email. JSONObject user = jObj. if (!name.getString("email"). // Launch login activity Intent intent = new Intent( RegisterActivity.toString().this.Listener<String>() { @Override public void onResponse(String response) { Log.show().getJSONObject("user" String name = user. uid. // Link to Login Screen btnLinkToLogin. name. "Register Response: " + response.class).setOnClickListener(new View. String email = inputEmail. hideDialog(). startActivity(intent).trim().addUser(name.isEmpty() && !email.isEmpty()) { registerUser(name.makeText(getApplicationContext(). } /** * Function to store user in MySQL database will post params(tag. new Response. password) to register url * */ private void registerUser(final String name. LoginActivity.getBoolean("error"). show(). email). .makeText(getApplicationContext(). } private void hideDialog() { if (pDialog.isShowing()) pDialog.LENGTH_LONG). String> params = new HashMap<String. } } catch (JSONException e) { e. } } }. } }) { @Override protected Map<String. Toast.put("email".printStackTrace(). // Adding request to request queue AppController. password).getString("error_msg" Toast. error.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Log.getInstance().dismiss().makeText(getApplicationContext(). } }. } } Run the app and navigate to register screen by tapping on the link below login button. return params.getMessage()).show(). name).addToRequestQueue(strReq. hideDialog().put("password". "Registration Error: " + error. } else { // Error occurred in registration. params. Toast. errorMsg. String> getParams() { // Posting params to register url Map<String.getMessage().e(TAG.put("name". Toast.isShowing()) pDialog. params. String>(). new Response.show(). } private void showDialog() { if (!pDialog.LENGTH_LONG). params. Get the error // message String errorMsg = jObj. tag_string_req). xml under res ⇒ layout and add below code. 15. activity_main.${activityClass}" > <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_centerInParent="true" android:layout_marginLeft="20dp" android:layout_marginRight="20dp" android:gravity="center" android:orientation="vertical" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/welcome" android:textSize="20dp" /> <TextView android:id="@+id/name" android:layout_width="wrap_content" android:layout_height="wrap_content" . Now we’ll add the 㜀㌀nal screen to show the logged in user information.4.android.3 Adding the Home Screen Until now we are done with both login and registration screen. Create an xml 㜀㌀le named activity_main.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="${relativePackage}.com/apk/res/android xmlns:tools="http://schemas.android.xml <RelativeLayout xmlns:android="http://schemas. This information will be fetched from SQLite database once user is logged in. // session manager session = new SessionManager(getApplicationContext()).view.Button. The logout button will logout the user by clearing the session and deleting the user from SQLite table. public class MainActivity extends Activity { private TextView txtName.activity_main). Here we are just fetching the logged user information from SQLite and displaying it on the screen. private TextView txtEmail. @Override protected void onCreate(Bundle savedInstanceState) { super. // SqLite database handler db = new SQLiteHandler(getApplicationContext()). import java.Activity. btnLogout = (Button) findViewById(R. import info. import android.id.os. import android. if (!session.SQLiteHandler.widget.name). Open the MainActivity. } .View.helper.email). txtEmail = (TextView) findViewById(R.app.onCreate(savedInstanceState). import info.loginandregistration. import android.java package info.TextView.Intent. txtName = (TextView) findViewById(R.helper.java and do below changes.loginandregistration. import android.id.SessionManager.androidhive.content. private SQLiteHandler db.btnLogout).loginandregistration.androidhive.id. setContentView(R.layout. import android. MainActivity.HashMap.Bundle. android:padding="10dp" android:textColor="@color/lbl_name" android:textSize="24dp" /> <TextView android:id="@+id/email" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="13dp" /> <Button android:id="@+id/btnLogout" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="40dip" android:background="@color/btn_logut_bg" android:text="@string/btn_logout" android:textAllCaps="false" android:textColor="@color/white" android:textSize="15dp" /> </LinearLayout> </RelativeLayout> 16.androidhive. import android.util. private Button btnLogout. private SessionManager session.isLoggedIn()) { logoutUser().widget. db.getUserDetails().get("name"). // Displaying the user details on the screen txtName. } }). txtEmail. startActivity(intent). } /** * Logging out the user. . } } Now if you run the app.setText(name).setLogin(false). you should see the below screen after successful login. String email = user. // Launching the login activity Intent intent = new Intent(MainActivity.setText(email).this. String name = user. Will set isLoggedIn flag to false in shared * preferences Clears the user data from sqlite users table * */ private void logoutUser() { session.get("email").OnClickListener() { @Override public void onClick(View v) { logoutUser().deleteUsers(). String> user = db. // Fetching user details from sqlite HashMap<String. finish().setOnClickListener(new View. // Logout button click event btnLogout. LoginActivity. MySQL RESTful services to DigitalOcean explains how to deploy your REST services online. > Read How to create REST API for Android app using PHP. Testing the App For a beginner it will be always di ㈀cult to run this project for the 㜀㌀rst time.java with your machine ip address. its time to improvise your knowledge by following the below articles. But don’t worry. So that the urls will be accessible globally. (The ip address looks like 192. password and database name of MySQL in Con㜀㌀g. Slim and MySQL to learn how to develop a proper REST API for your android app.168. Change Log . ⇒ Give correct username .0. You can get the ip address by running ipcon㜀㌀g in cmd What’s Next? If you understand this article very clearly.5. > Android Hosting PHP. the following steps will helps you testing this app.php ⇒ Replace the URL ip address of URL _L O GI N and URL _R EGI ST ER in AppCon㜀㌀g.100) ⇒ Make sure that both devices (the device running the PHP project and the android device) are on the same wi㜀㌀ network. .functions. Solving real problems of Android developers through tutorials has always been interesting part for him. RELATED POSTS Android Building Free Wallpapers App – Part 1 Android JSON parsing using Volley Android working with Volley Library by Ravi Tamada by Ravi Tamada by Ravi Tamada Android Uploading Camera Image....This site can’t be reached Plz help ....plz help △ ▽ • Reply • Share › Deepak Mani • 2 days ago Fatal error: Call to a member function prepare() on null ...Updated On 28th Feb 2016 (Android Studio IDE) ABOUT THE AUTHOR ravi8x Ravi is hardcore Android programmer and Android programming has been his passion since he compiled his 㜀㌀rst hello-world program.......... △ ▽ • Reply • Share › knikaha • 3 days ago i tried to downloading project files with no luck .... in functions.. anybody plz help.. Video to Server with Progress Bar by Ravi Tamada 3479 Comments Recommend 132 Android Hive ⤤ Share 1 Login Sort by Newest Join the discussion… Saloni Garg • a day ago What is the use of sqlite when we are using database in xampp? △ ▽ • Reply • Share › Deepak Mani • 2 days ago Fatal error: Call to a member function prepare() on null in.php when i'm passing the values through postman ..php getting error when i'm trying to pass values through postman. which runs on Cpanel .△ ▽ • Reply • Share › Ravi Tamada Mod > knikaha • 2 days ago pls try now! △ ▽ • Reply • Share › Shanmugam R • 5 days ago nice tutorial thanks friend △ ▽ • Reply • Share › khaled ahmed • 6 days ago i test connection by Postman and it gives me an error " {"error":true. and when i testing it from android device getting 403 status code i am sure i am closing firewall and changing ip to mine △ ▽ • Reply • Share › Habib Olou • 7 days ago Hello."error_msg":"Required parameters (name.php at this line: $user = $stmt>get_result()>fetch_assoc(); △ ▽ • Reply • Share › Chilly Vids • 7 days ago Hi guys my registration works perfekt but when I try to log in I get the following error: Call to undefined method mysqli_stmt::get_result() How can I fix this problem? △ ▽ • Reply • Share › Habib Olou > Chilly Vids • 6 days ago Hello. Were you able to solve it? △ ▽ • Reply • Share › jrdev761 > Habib Olou • 6 days ago same problem but works perfect when working using wamp or local database △ ▽ • Reply • Share › Ravi Tamada Mod > jrdev761 • 6 days ago Which hosting you are trying on? △ ▽ • Reply • Share › jrdev761 > Ravi Tamada • 6 days ago I am using NameCheap server. android or genymotion. △ ▽ • Reply • Share › Ravi Tamada Mod > khaled ahmed • 6 days ago Are you sure you are posting the parameters? name. △ ▽ • Reply • Share › khaled ahmed > Ravi Tamada • 6 days ago yes. i am having the same problem. i am getting an error: Fatal error: Call to undefined method mysqli_stmt::get_result() in /include/DB_Functions. email and password. email or password) is missing!"}" also i am sending the exact required parameter what should i do ! △ ▽ • Reply • Share › jrdev761 > khaled ahmed • 5 days ago what emulator are you using. how can create voice call option same like ..△ ▽ • Reply • Share › Ravi Tamada Mod > Habib Olou • 6 days ago You need to enable mysqli support. △ ▽ • Reply • Share › jrdev761 > Ravi Tamada • 5 days ago from the Android Studio: BasicNetwork. City. I have been able to solve this issue...performRequest: Unexpected response code 500 for http://www.androidhive... I was using bind_result instead of using get_result./login_api/login.. Check the logs.. // check for successful store if ($result) { $stmt = $this>conn>prepare("SELECT * FROM users WHERE email = ?"); $stmt>bind_param("s".. △ ▽ • Reply • Share › jrdev761 > Ravi Tamada • 6 days ago I have enabled it already △ ▽ • Reply • Share › Ravi Tamada Mod > jrdev761 • 6 days ago There might be another problem../blwnewmedia/login_api/include/DB_Functions..php on line 65 △ ▽ • Reply • Share › jrdev761 > jrdev761 • 5 days ago Actually. $email); $stmt>execute(); $user = $stmt>bind_result()>fetch_assoc(); $stmt>close(); return $user; } else { return false; } △ ▽ • Reply • Share › Andre Keren • 7 days ago how if i can make a much field form for registration? Ex : Name .... please refer to http://stackoverflow.... Zip Code and many thanks △ ▽ • Reply • Share › yoyo • 9 days ago import info....com/quest.R How to make and import R? △ ▽ • Reply • Share › jrdev761 > yoyo • 5 days ago you might want to try to clean and rebuild project △ ▽ • Reply • Share › Haqnawaz Gul • 16 days ago Hi : i am just Wanna know .loginandregistration.php Login Error: null Php Log: PHP Fatal error: Call to undefined method mysqli_stmt::get_result() in ...Address. php.RegisterActivity.java:4240) at android.whatsapp △ ▽ • Reply • Share › Abimelec Reyes • 17 days ago Modify two can make the code △ ▽ • Reply • Share › Sunitha Bist • 20 days ago Actually I'm trying to run with another server.:/usr/lib/php:/usr/local/lib/php') in /home/a7622610/public_html/android_login_api/register.app.Method. so If try to access http://itzmee.internal.ZygoteInit.aprox.net23..NativeStart.php' (include_path='.onClick(RegisterActivity.com.com.Looper.run(ZygoteInit.java at ph.php' (include_path='.dispatchMessage(Handler.net/androi.net23.reflect. ...require]: Failed opening required '/home/a7622610/public_html/include/DB_Functions.Fatal error: require_once() [function.View.Method.RegisterActivity.RegisterActivity$1.com.java at ph.Handler..java:92) at android.performClick(View.android..java:137) at android.:/usr/lib/php:/usr/local/lib/php') in /home/a7622610/public_html/register.lang.java:17721) at android.java:730) at android.invokeNative(Native Method) at java.access$300(RegisterActivity.activity.java:5103) at java.php on line 3 △ ▽ • Reply • Share › shashi patil > Sunitha Bist • 16 days ago check the given path △ ▽ • Reply • Share › John Alexis Lagmay • 22 days ago FATAL EXCEPTION: main java.aprox.aprox.net is my server name △ ▽ • Reply • Share › Sunitha Bist • 20 days ago Hi Sir!! Im getting this error while compiling the register. plzz try to help me Fatal error: require_once() [function.main(ActivityThread.java:525) at com.view.lang.lang. im not getting any json services instead of that im getting these error messages.View$PerformClick.main(ZygoteInit.run(View.aprox.internal.registerUser(RegisterActivity.Handler.os.java:737) at com.main(Native Method) I keep on getting this error message whenever I click register button △ ▽ • Reply • Share › Karan Brahmaxatriya > John Alexis Lagmay • 4 days ago same error i got pls help me out △ ▽ • Reply • Share › Adel Abdallah • 23 days ago clear and amazing .activity..aprox.invoke(Method.ZygoteInit$MethodAndArgsCaller.php on line 3 itzmee.view.handleCallback(Handler.reflect.os.java:553) at dalvik.java:79) at android.NullPointerException at ph.os.loop(Looper.require]: Failed opening required 'include/DB_Functions.ActivityThread.system.android.activity.os.aprox.os. handleCallback(Handler. $year. password. $email.main(Native Method) △ ▽ • Reply • Share › Karan Brahmaxatriya > Ravi Tamada • 4 days ago same error i facing pls help me △ ▽ • Reply • Share › Burhan CR • 24 days ago ravi sir i'm getting this "Unknown error occurred in registration!" what might be the problem? △ ▽ • Reply • Share › Ravi Tamada Mod > Burhan CR • 24 days ago Try hitting the url using Chrome Postman extension and see if there are any php errors.android.View$PerformClick. $uuid.onClick( at android. NOW())"); $stmt>bind_param("ssssssss".Looper.java:511) at com. ?. year.os. $branch.java:605) at android.reflect.java:4424) at java. createdat) VALUES(?.karanbrahmaxatriya.java at com.dispatchMessage(Handler. $name.loginandregister. email or password) is missing!" //here is what i changed in the code public function storeUser($name.RegisterActivity.ActivityThread.reflect.invoke(Method.os.loop(Looper. $rollno. ?.java:92) at android.run(ZygoteInit.internal.karanbrahmaxatriya. $salt); .java:137) at android. salt. branch.ZygoteInit.android.main(ZygoteInit.Handler.app. ?.main(ActivityThread.run(View.os.RegisterActivity$1.registerUser( at com.os.NullPointerException at com.example.activity.lang.view. $password) { $uuid = uniqid(''.karanbrahmaxatriya.java:584) at dalvik. true); $hash = $this>hashSSHA($password); $encrypted_password = $hash["encrypted"]; // encrypted password $salt = $hash["salt"]; // salt $stmt = $this>conn>prepare("INSERT INTO studentdata(uniqueid. ?. ?.example. rollno.RegisterActivity.loginandregister.NativeStart. ?.view. year.os.activity.access$300( at com.system.activity. ?.internal.Method.Handler.ZygoteInit$MethodAndArgsCaller.View.java:3528) at android. $email. $branch. $rollno. $encrypted_password.Method. rollno. name.loginandregister.performClick(View.lang.example.△ ▽ • Reply • Share › Ravi Tamada Mod > Adel Abdallah • 23 days ago :) △ ▽ • Reply • Share › Karan Brahmaxatriya > Ravi Tamada • 4 days ago FATAL EXCEPTION: main java. △ ▽ • Reply • Share › Burhan CR > Ravi Tamada • 24 days ago using the postman extension it says "Required parameters (name. branch. email.java:14235) at android.invokeNative(Native Method) at java. $year.lang. view.internal.smartstudy.activity.smartstudy.loginandregistration. java. It helped getting me started.ZygoteInit.applications.lang.ActivityThread.android.java at com.activity.NullPointerException at com.applications.inma.Handler.java at com.java:733) at android.os.run(ZygoteInit.access$300(RegisterActivity.java:18422) at android.internal.activity.Method.registerActivity.Handler. △ ▽ • Reply • Share › Chinemerem • 25 days ago Hi ravi I tried to complile your exampe but it gives me the following errors on Login and Register Activity Method onErrorResponse does not override method from its superclass Method onResponse does not override method from its superclass There is no applicable constructor to '(int..java:4438) at android.invokeNative(Native Method) at java. (anonymous).lang.java:515) at com.$result = $stmt>execute(); see more △ ▽ • Reply • Share › Burhan CR > Burhan CR • 24 days ago and while using android studio it gives me the following error "Unknown error occurred in registration!" △ ▽ • Reply • Share › Burhan CR > Burhan CR • 22 days ago ravi sir any help please △ ▽ • Reply • Share › Ravi Tamada Mod > Burhan CR • 21 days ago Send request to login and registration from Chrome Postman extension and see if they are working or not.main(ActivityThread.reflect.lang.registerActivity. (anonymous))' △ ▽ • Reply • Share › Ravi Tamada Mod > Chinemerem • 25 days ago Can u paste the complete code block which is causing error.reflect.androidhive.os.string.loop(Looper.os.os.applications.main(ZygoteInit.Method.registerUser(RegisterActivity.View.Looper.invoke(Method. " java. Mostly you should check if you have defined the button . △ ▽ • Reply • Share › Immaculata Ubah • a month ago Thank you Ravi for this tutorial.java:601) at dalvik.java:5001) at java.inma.main(Native Method)" How do i resolve this? Thanks △ ▽ • Reply • Share › Nicky N > Immaculata Ubah • 24 days ago if you showed the code which has exception.RegisterActivity.onClick(RegisterActivity.ZygoteInit$MethodAndArgsCaller. i kept running into null pointer error when i click on the register button.performClick(View.loginandregisration.android..RegisterActivity.java:95) at android.java:785) at com.View$PerformClick.os.app.java:136) at android.run(View. info.androidhive.java at android.system.smartstudy.NativeStart.RegisterActivity$1.view.activity.handleCallback(Handler.lang.inma.dispatchMessage(Handler.activity. info. games.) and you defined the correct one △ ▽ • Reply • Share › Immaculata Ubah > Nicky N • 22 days ago Thanks. I have resolved it △ ▽ • Reply • Share › Karan Brahmaxatriya > Immaculata Ubah • 4 days ago how u resolved it? △ ▽ • Reply • Share › qweqwe > Immaculata Ubah • 25 days ago did u added AppController in AndroidManifest? QUICK CONTACT ABOUT ANDROIDHIVE Advertise with us AndroidHive is beginner's Privacy Policy paradise for android tutorials. Sitemap hacks and super cool advanced topics. tips Terms of Service & tricks. Copyright © 2016 Droid5 Informatics Pvt Ltd.(findviewbyid. .. app reviews.
Copyright © 2024 DOKUMEN.SITE Inc.