android.os.NetworkOnMainThreadException at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1145)

This exception is thrown when application attempts to perform a networking operation in the main thread. Use below code in your onViewCreated to avoid this error else Call your networking operations (getting data from web server) request in thread or Asynch class.

public void onViewCreated(View view, Bundle savedInstanceState) 
{
    int SDK_INT = android.os.Build.VERSION.SDK_INT;
    if (SDK_INT > 8) 
    {
        StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
                .permitAll().build();
        StrictMode.setThreadPolicy(policy);
        //your codes here

    }
}

Try to add this code:

Add this code below the line in you user login activity

         setContentView(R.layout.user_login);
        if (android.os.Build.VERSION.SDK_INT > 9)
        {
            StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
            StrictMode.setThreadPolicy(policy);
        }

Hope this may help you!