private void makeUserProfileRequest() {
    if (!mAppState.getAccessToken().isEmpty()) {
      HttpPost userProfileRequest = new HttpPost(this, PConstants.USER_PROFILE_URL);

      HashMap<String, String> requestParameters = new HashMap<>();
      requestParameters.put(PConstants.URL, PConstants.USER_PROFILE_URL);
      requestParameters.put("accessToken", mAppState.getAccessToken());

      userProfileRequest.run(requestParameters);
    } else {
      mParentActivity.showNextView(new LoginFragment());
    }
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mRootView = inflater.inflate(R.layout.fragment_profile, container, false);

    mAppState = AppState.getInstance();
    // checks for access token. Does auto login if access token is empty
    // else make user request
    if (TextUtils.isEmpty(mAppState.getAccessToken())) {
      Login loginObj = mAppState.getUserCredentials();
      if (loginObj != null
          && loginObj.loginName != null
          && !loginObj.loginName.isEmpty()
          && loginObj.loginPassword != null
          && !loginObj.loginPassword.isEmpty()) {
        mUserName = loginObj.loginName;
        mPwd = loginObj.loginPassword;
        makeRequest();
      }
    } else {
      makeUserProfileRequest();
    }

    mUserProfileLayout = mRootView.findViewById(R.id.user_profile_layout);
    mUserImageView = (ImageView) mRootView.findViewById(R.id.profile_img);
    mUserNameTextView = (TextView) mRootView.findViewById(R.id.user_name);
    mMemberSinceTextView = (TextView) mRootView.findViewById(R.id.member_since);
    mUserShelfCountTextView = (TextView) mRootView.findViewById(R.id.user_shelf_count);
    mListView = (ListView) mRootView.findViewById(R.id.profile_list_view);
    mLoginButton = (Button) mRootView.findViewById(R.id.progile_login_btn);
    mProgressBarLayout = mRootView.findViewById(R.id.progress_bar_layout);

    mLoginButton.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View arg0) {
            mParentActivity.showNextView(new LoginFragment());
          }
        });

    if (mUserProfile != null) {
      if (mUserProfile.firstName != null) mUserNameTextView.setText(mUserProfile.firstName);
      if (mUserProfile.memberDOJ != null)
        mMemberSinceTextView.setText(mUserProfile.memberDOJ.toString());

      // Check not required for below as it will take default values
      String imgURI = mUserProfile.userImgUrl;
      mUserShelfCountTextView.setText("" + mUserProfile.shelfBookCount);
      mParentActivity.mImageLoader.displayImage(imgURI, mUserImageView);

      // setting visibility
      mUserProfileLayout.setAlpha(1);
      mLoginButton.setVisibility(View.GONE);
    } else {
      mUserProfileLayout.setAlpha(0.2f);
      mLoginButton.setVisibility(View.VISIBLE);
    }

    ProfileAdapter adapter =
        new ProfileAdapter(mParentActivity, R.layout.layout_list_view_text_item, mProfileItemsList);
    mListView.setAdapter(adapter);
    mListView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> adapter, View view, int position, long id) {
            switch (position) {
              case 0:
              case 1:
                Bundle bundle = new Bundle();
                bundle.putInt("MENU_TYPE", position);
                mParentActivity.showNextView(new ProfileLanguageFragment(), bundle);
                break;

              case 2:
                mParentActivity.showNextView(new AboutFragment());
                break;
            }
          }
        });
    return mRootView;
  }