if you are an app developer and do not want to do backend stuff parse.com is the way to go. With parse.com you can focus on building your app and does not want to waste time on building backend.

Register with parse.com

First we have to create a account in parse.com and create a application on parse.com. Follow below steps



Login and register with parse.com

Adding parse compile dependencies

First we will add parse library to build.gradle

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.parse.bolts:bolts-android:1.+'
    compile 'com.parse:parse-android:1.12.0'
}

Add internet permission to AndroidManifest.xml

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

Adding parse application in AndroidManifest.xml

Add APPLICATION ID & CLIENT ID in AndroidManifest.xml inside tag

<!-- parse -->
        <meta-data
            android:name="com.parse.APPLICATION_ID"
            android:value="YOUR APPLICAION ID" />
        <meta-data
            android:name="com.parse.CLIENT_KEY"
            android:value="YOUR CLIENT KEY" />
        <!-- /parse -->

Creating a custom application class – MyApplication.java

We will create a custom application class and so that we doesnt have to initialize parse on every Activity

package com.hackerkernel.loginregisterwithparse;

import android.app.Application;

import com.parse.Parse;

public class MyApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        Parse.initialize(this);
    }
}

Adding custom application (MyApplication.java) to the AndroidManifest.xml

<application
        android:name=".MyApplication">
<!-- Other stuff -->
</application>

activity_main.xml – (Register layout)

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    tools:context="com.hackerkernel.loginregisterwithparse.MainActivity">

    <!-- Toolbar -->
    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="@color/colorPrimary"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
        />
    <!-- /Toolbar -->

    <!-- Register form container -->
    <LinearLayout
        android:layout_below="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_margin="20dp"
        android:orientation="vertical">


        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/fullname"
            android:id="@+id/regFullname"
            android:layout_marginBottom="10dp"/>

        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:inputType="textEmailAddress"
            android:hint="@string/emailaddress"
            android:ems="10"
            android:id="@+id/regEmail"
            android:layout_marginBottom="10dp"/>

        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:inputType="phone"
            android:hint="@string/phonenumber"
            android:ems="10"
            android:id="@+id/regPhonenumber"
            android:layout_marginBottom="10dp"/>

        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:inputType="textPassword"
            android:hint="@string/password"
            android:ems="10"
            android:id="@+id/regPassword"
            android:layout_marginBottom="10dp"/>

        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/register"
            android:id="@+id/register"
            android:layout_marginBottom="20dp"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            style="@style/Base.TextAppearance.AppCompat.Medium"
            android:text="Already a member? Login"
            android:id="@+id/goToLogin"
            android:layout_gravity="center_horizontal" />

    </LinearLayout>
    <!-- / Register form container -->


</RelativeLayout>

MainActivity.java

This this activity we are getting all the values from the EditText and sending them to parse.com and as soon has we get success from parse.com we will set the user to HomeActivity

package com.hackerkernel.loginregisterwithparse;

import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import com.parse.ParseException;
import com.parse.ParseUser;
import com.parse.SignUpCallback;

public class MainActivity extends AppCompatActivity {
    private EditText mFullname;
    private EditText mEmail;
    private EditText mPhone;
    private EditText mPassword;
    private Button mRegister;
    private TextView mGoToLogin;
    public ProgressDialog pd;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        assert getSupportActionBar() != null;
        getSupportActionBar().setTitle("Register");

        //Create a progressdialog
        pd = new ProgressDialog(this);
        pd.setMessage("Please wait");
        pd.setCancelable(true);

        //Check user is logged in
        ParseUser currentUser = ParseUser.getCurrentUser();
        if (currentUser != null) {
            //Send user to HomeActivity
            goToHomeActivity();
        }

        //instanciate views
        mFullname = (EditText) findViewById(R.id.regFullname);
        mEmail = (EditText) findViewById(R.id.regEmail);
        mPhone = (EditText) findViewById(R.id.regPhonenumber);
        mPassword = (EditText) findViewById(R.id.regPassword);
        mRegister = (Button) findViewById(R.id.register);
        mGoToLogin = (TextView) findViewById(R.id.goToLogin);

        //When Register button is clicked
        mRegister.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //Call Register Method
                register();
            }
        });

        //When GoToLogin button is clicked start loginActivity
        mGoToLogin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(getApplication(),LoginActivity.class));
            }
        });
    }

    private void register() {
        String fullname = mFullname.getText().toString().trim();
        String email = mEmail.getText().toString().trim();
        String phone = mPhone.getText().toString().trim();
        String password = mPassword.getText().toString().trim();

        //check fields are not empty
        if(!fullname.isEmpty() && !email.isEmpty() && !phone.isEmpty() && !password.isEmpty()){
            pd.show(); //show progressDialog
            //Store user info in Parse.com
            ParseUser user = new ParseUser();
            user.setUsername(fullname);
            user.setEmail(email);
            user.put("phone", phone);
            user.setPassword(password);

            user.signUpInBackground(new SignUpCallback() {
                @Override
                public void done(ParseException e) {
                    pd.dismiss(); //hide progressDialog
                    if(e == null){
                        //Hurray signup completed
                        goToHomeActivity();
                    }else{
                        //Signup didnt work some error
                        Toast.makeText(getApplication(), e.getMessage(), Toast.LENGTH_SHORT).show();
                    }
                }
            });
        }else{
            Toast.makeText(getApplication(), R.string.fill_in_all_the_fields, Toast.LENGTH_SHORT).show();
        }
    }

    private void goToHomeActivity() {
        Intent intent = new Intent(getApplication(),HomeActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(intent);
    }


}



activity_login.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.hackerkernel.loginregisterwithparse.LoginActivity">

    <!-- Toolbar -->
    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="@color/colorPrimary"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
        />
    <!-- /Toolbar -->

    <!-- login form container -->
    <LinearLayout
        android:layout_below="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_margin="20dp"
        android:orientation="vertical">

        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/fullname"
            android:id="@+id/logUsername"
            android:layout_marginBottom="10dp"/>

        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:inputType="textPassword"
            android:hint="@string/password"
            android:ems="10"
            android:id="@+id/logPassword"
            android:layout_marginBottom="10dp"/>

        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/login"
            android:id="@+id/login"
            android:layout_marginBottom="20dp"/>

    </LinearLayout>
    <!-- / login form container -->
</RelativeLayout>

LoginActivity.java

package com.hackerkernel.loginregisterwithparse;

import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.parse.LogInCallback;
import com.parse.ParseException;
import com.parse.ParseUser;

public class LoginActivity extends AppCompatActivity {
    private EditText mFullname;
    private EditText mPassword;
    private Button mLogin;
    public ProgressDialog pd;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);

        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        assert getSupportActionBar() != null;
        getSupportActionBar().setTitle(getString(R.string.login));

        //Create a progressdialog
        pd = new ProgressDialog(this);
        pd.setMessage("Please wait");
        pd.setCancelable(true);


        mFullname = (EditText) findViewById(R.id.logUsername);
        mPassword = (EditText) findViewById(R.id.logPassword);
        mLogin = (Button) findViewById(R.id.login);

        //When login button is clicked
        mLogin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //Call Register Method
                login();
            }
        });
    }

    private void login() {
        String password = mPassword.getText().toString().trim();
        String username = mFullname.getText().toString().trim();

        //check fields are not empty
        if(!password.isEmpty() && !username.isEmpty()){
            pd.show(); //show progressDialog
            ParseUser.logInInBackground(username, password, new LogInCallback() {
                @Override
                public void done(ParseUser user, ParseException e) {
                    pd.dismiss();//hide Pd
                    if (user != null) {
                        // Hooray! The user is logged in.
                        goToHomeActivity();
                    } else {
                        Toast.makeText(getApplication(), e.getMessage(), Toast.LENGTH_SHORT).show();
                    }
                }
            });
        }else{
            Toast.makeText(getApplication(), R.string.fill_in_all_the_fields, Toast.LENGTH_SHORT).show();
        }
    }

    private void goToHomeActivity() {
        Intent intent = new Intent(getApplication(),HomeActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(intent);
    }
}

activity_home.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    tools:context="com.hackerkernel.loginregisterwithparse.HomeActivity">

    <!-- Toolbar -->
    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="@color/colorPrimary"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
        />
    <!-- /Toolbar -->

    <TableLayout
        android:id="@+id/table"
        android:layout_below="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="20dp"
        android:stretchColumns="1">

        <TableRow android:layout_marginBottom="10dp">
            <TextView
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:text="@string/fullname"/>

            <TextView
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:gravity="right"
                android:text="Husain saify"
                android:id="@+id/homeFullname"/>
        </TableRow>

        <TableRow android:layout_marginBottom="10dp">
            <TextView
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:text="@string/emailaddress"/>

            <TextView
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:gravity="right"
                android:text="Husain saify"
                android:id="@+id/homeEmail"/>
        </TableRow>

        <TableRow android:layout_marginBottom="10dp">
            <TextView
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:text="@string/phonenumber"/>

            <TextView
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:gravity="right"
                android:text="Husain saify"
                android:id="@+id/homePhone"/>
        </TableRow>

    </TableLayout>

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Logout"
        android:id="@+id/logout"
        android:layout_below="@+id/table"
        android:layout_centerHorizontal="true" />

</RelativeLayout>

HomeActivity.java

In HomeActivity we will display the current user details and Create a logout button for user

package com.hackerkernel.loginregisterwithparse;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.parse.ParseUser;

public class HomeActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_home);
        //Set toolbar
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        assert getSupportActionBar() != null;
        getSupportActionBar().setTitle("Welcome");


        //instanciate views
        TextView fullname = (TextView) findViewById(R.id.homeFullname);
        TextView email = (TextView) findViewById(R.id.homeEmail);
        TextView phone = (TextView) findViewById(R.id.homePhone);
        Button logout = (Button) findViewById(R.id.logout);

        //get logged in user
        ParseUser currentUser = ParseUser.getCurrentUser();

        fullname.setText(currentUser.getUsername());
        email.setText(currentUser.getEmail());
        phone.setText(currentUser.getString("phone"));

        //When logout button is clicked logout the user and send him to mainActivity
        logout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ParseUser.logOut();
                //send user to MainActivity
                Intent intent = new Intent(getApplication(),MainActivity.class);
                intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                startActivity(intent);
            }
        });
    }
}