Sunday 16 April 2017

Test

section recycler view
http://android-pratap.blogspot.in/search/label/Sectioned%20RecyclerView
https://inducesmile.com/android/add-sections-in-android-recyclerview-with-sectionedrecyclerviewadapter-library/

http://stackoverflow.com/questions/3515198/share-text-on-facebook-from-android-app-via-action-send

1)activity_main.xml
===============
<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"
    tools:context="com.example.weightdemo.MainActivity" >

    <LinearLayout
        android:id="@+id/lyt"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:background="@android:color/black"
        android:gravity="bottom"
        android:orientation="horizontal" >

        <TextView
            style="@style/txt_style"
            android:layout_weight="0.10"
            android:singleLine="false"
            android:text="@string/sr_no" />

        <TextView
            style="@style/txt_style"
            android:layout_weight="0.30"
            android:singleLine="true"
            android:text="Item name " />

        <TextView
            style="@style/txt_style"
            android:layout_weight="0.15"
             android:singleLine="true"
            android:text="Price" />

        <TextView
            style="@style/txt_style"
            android:layout_weight="0.10"
             android:singleLine="true"
            android:text="*" />

        <TextView
            style="@style/txt_style"
            android:layout_weight="0.15"
             android:singleLine="true"
            android:text="QTY" />

        <TextView
            style="@style/txt_style"
            android:layout_weight="0.20"
             android:singleLine="true"
            android:text="Total Priice" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/lyt"
        android:orientation="vertical" >

        <include layout="@layout/row_item" />
    </LinearLayout>

</RelativeLayout>

2)row.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:background="@android:color/black"
        android:gravity="bottom"
        android:orientation="horizontal" >

        <TextView
            style="@style/txt_style"
            android:layout_weight="0.10"
            android:singleLine="false"
            android:text="@string/sr_no" />

        <TextView
            style="@style/txt_style"
            android:layout_weight="0.30"
            android:text="Margarita Pizza" />

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            android:layout_weight="0.15"
            android:gravity="bottom"
            android:orientation="horizontal" >

            <TextView
                style="@style/txt_style"
                android:layout_weight="0.25"
                android:text="rs"
                android:textColor="@android:color/white" />

            <TextView
                style="@style/txt_style"
                android:layout_weight="0.75"
                android:text="255"
                android:textColor="@android:color/white" >
            </TextView>
        </LinearLayout>

        <TextView
            style="@style/txt_style"
            android:layout_weight="0.10"
            android:text="*" />

        <TextView
            style="@style/txt_style"
            android:layout_weight="0.15"
            android:text="2" />

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            android:layout_weight="0.20"
            android:gravity="bottom"
            android:orientation="horizontal" >

            <TextView
                style="@style/txt_style"
                android:layout_weight="0.15"
                android:text="rs"
                android:textColor="@android:color/white" />

            <TextView
                style="@style/txt_style"
                android:layout_weight="0.85"
                android:text="255"
                android:textColor="@android:color/white" >
            </TextView>
        </LinearLayout>
    </LinearLayout>

</LinearLayout>

=========================
sppinner

package com.fragments;

import android.Manifest;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.MediaStore;
import android.provider.Settings;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.TextInputLayout;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.support.v4.graphics.drawable.RoundedBitmapDrawable;
import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
import android.util.Patterns;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RelativeLayout;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.target.BitmapImageViewTarget;
import com.google.gson.Gson;
import com.mind.intellimind.R;
import com.mind.intellimind.activities.HomeActivity;
import com.mind.intellimind.asyncktask.Util;
import com.mind.intellimind.beans.Industry.IndustryList;
import com.mind.intellimind.beans.ExtraSingle.GeneralResponsePojo;
import com.mind.intellimind.beans.Profile.UserProfileDataPojo;
import com.mind.intellimind.customview.CircleDisplay;
import com.mind.intellimind.utility.Constants;
import com.mind.intellimind.utility.RestClient;
import com.mind.intellimind.utility.SessionManager;
import com.mind.intellimind.utility.Utils;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import retrofit.Callback;
import retrofit.RetrofitError;
import retrofit.client.Response;
import retrofit.mime.TypedByteArray;
import retrofit.mime.TypedInput;

/**
 * Created by admin on 20/04/2016.
 */

public class ProfileFragment extends Fragment implements View.OnClickListener, CircleDisplay.SelectionListener {
    RelativeLayout pd;
    View view;
    private CircleDisplay circleTech, circleHealthCare, circleUtilities;
    private TextView txtPersonalProfile, txtinvestorProfile, txtLocation;
    private Spinner spnIndustry;
    private ArrayAdapter<String> aadpIndustryName = null;
    private ArrayList<String> alstIndustryName;
    public static final int RESULT_LOAD_CAMERA = 1;
    public static final int RESULT_LOAD_GALLERY = 2;
    private String profile_pic_path = "";
    String file_path_profile = "", folder_path_profile = "";
    private Uri mImageProfilePicUri;
    private ImageView imgProfile, imgCover, imgEdit, imgCoverBg;
    private CheckBox chkNickName;
    private EditText edtFirstName, edtLastName, edtProfession, edtLocation, edtIncome, edtNick_name, edtEmail, edtPassword;
    private TextInputLayout inputLayout_FirstName, intputLayout_LastName, inputLayout_Email, inputLayout_Profession, inputLaout_Location, inputLayout_Income, inputLayout_NickName, input_layout_password;
    public int intIndustryPos = 0;
    private LinearLayout lytContentPersonal, lytContentInvestor;
    //Investor Profile
    private TextView txtAddChild, txtShortTerm, txtMidiumTerm, txtLongTerm, txtName;
    private ImageView imgShortTermDrawble, imgMidiumTermDrawable, imgLongTermDrawable;
    private Spinner spnNetLiquidCapital, spnRetirementAge, spnFirstChildAge, spnSecondChildAge, spnTaxFillingStatus;
    private RadioGroup radioGroupLeverage, radioGroupChild;
    private RadioButton rbtnLeverageYes, rbtnLeverageNo, rbtnChildYes, rbtnChildNo;
    private Button btnSubmit;
    public boolean isChild = true;
    private LinearLayout lytChild, lytSecondChildAge, lytIdea, lytWatchList, lytActivity, lytSetting;
    LayoutInflater inflater;
    private ArrayAdapter<String> aadpAnnualIncome = null;
    private ArrayAdapter<String> aadpNetLiquidCapital = null;
    private ArrayAdapter<String> aadpTaxFillingStatus = null;
    private ArrayAdapter<String> aadpRetirementAge = null;
    private ArrayAdapter<String> aadpFirstChildAge = null, aadpSecondChildAge = null;
    private ArrayList<String> alstNetLiquiedCapital, alstTaxFillingStatus, alstRetirementAge;
    private ArrayList<String> alstFirstChildAge, alstSecondChild, alstSeletedChild;
    int intChild = 0;
    private String strInvesmentHorizon = "", strSecondChildAge = "", strBase64 = "";
    private Button btnPersonalProfileSubmit, btnInvestorProfileSubmit;
    public static final int REQUEST_PERMISSION_SETTING = 100;
    public static final int REQUEST_SETTING = 101;
    private String strBirthDate = "", strFirstName = "", strLastName = "", strGender = "", strEmail = "", strIndustry = "", strLocation = "",
            strDeviceToken = "", strProfession = "", strNickName = "", strPicturePath = "", strAuthToken = "", strUserId = "", strLeverage = "YES", encodedString = "";
    SessionManager sessionManager;
    private CheckBox chkOnOff;
    private String strAnnualIncome = "", strNetLiquidCapital = "", strRetirementAge = "", strTaxFillingStatus = "";
    Gson gson;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        view = inflater.inflate(R.layout.fragment_profile, container, false);
        initUI();
        return view;
    }

    private void initUI() {
        gson = new Gson();
        InItCircle();

        pd = (RelativeLayout) view.findViewById(R.id.progress);
        pd.setVisibility(View.GONE);
        Utils.sharedPreferences = getActivity().getSharedPreferences(Utils.PREF_NAME, Context.MODE_MULTI_PROCESS);
        sessionManager = new SessionManager(getActivity());
        strAuthToken = sessionManager.getTOKEN();
        strUserId = sessionManager.getUSER_ID();

        lytContentPersonal = (LinearLayout) view.findViewById(R.id.lytContentPersonalProfile);
        lytContentInvestor = (LinearLayout) view.findViewById(R.id.lytContentInvestorProfile);

        spnIndustry = (Spinner) view.findViewById(R.id.spnIndustry);
        alstIndustryName = new ArrayList<>();
        txtPersonalProfile = (TextView) view.findViewById(R.id.txtPersonalProfile);
        txtPersonalProfile.setOnClickListener(this);
        txtinvestorProfile = (TextView) view.findViewById(R.id.txtinvestorProfile);
        txtinvestorProfile.setOnClickListener(this);
        txtPersonalProfile.setTextColor(getResources().getColor(R.color.colorGreenApp));
        txtinvestorProfile.setTextColor(getResources().getColor(R.color.colorWhiteWashApp));
        txtAddChild = (TextView) view.findViewById(R.id.txtAddChild);
        txtName = (TextView) view.findViewById(R.id.txtName);
        txtLocation = (TextView) view.findViewById(R.id.txtLocation);
        txtAddChild.setOnClickListener(this);
        imgEdit = (ImageView) view.findViewById(R.id.imgEdit);
        imgEdit.setOnClickListener(this);
        imgProfile = (ImageView) view.findViewById(R.id.imgProfile);
        imgProfile.setOnClickListener(this);
        imgCover = (ImageView) view.findViewById(R.id.imgCover);
        imgCover.setOnClickListener(this);
        imgCoverBg = (ImageView) view.findViewById(R.id.imgCoverBg);
        imgCoverBg.setOnClickListener(this);
        lytIdea = (LinearLayout) view.findViewById(R.id.lytIdeas);
        lytIdea.setOnClickListener(this);
        lytActivity = (LinearLayout) view.findViewById(R.id.lytActivity);
        lytActivity.setOnClickListener(this);
        lytWatchList = (LinearLayout) view.findViewById(R.id.lytWatchList);
        lytWatchList.setOnClickListener(this);
        lytSetting = (LinearLayout) view.findViewById(R.id.lytSetting);
        lytSetting.setOnClickListener(this);
        edtFirstName = (EditText) view.findViewById(R.id.edt_first_name);
        edtLastName = (EditText) view.findViewById(R.id.edt_last_name);
        edtEmail = (EditText) view.findViewById(R.id.edt_email);
        edtProfession = (EditText) view.findViewById(R.id.edt_profession);
        edtLocation = (EditText) view.findViewById(R.id.edt_location);
        edtNick_name = (EditText) view.findViewById(R.id.edt_nick_name);
        edtPassword = (EditText) view.findViewById(R.id.edt_password);
        inputLayout_FirstName = (TextInputLayout) view.findViewById(R.id.input_layout_first_name);
        intputLayout_LastName = (TextInputLayout) view.findViewById(R.id.input_layout_last_name);
        inputLayout_Email = (TextInputLayout) view.findViewById(R.id.input_layout_email);
        inputLayout_Profession = (TextInputLayout) view.findViewById(R.id.input_layout_profession);
        inputLaout_Location = (TextInputLayout) view.findViewById(R.id.input_layout_location);
        inputLayout_NickName = (TextInputLayout) view.findViewById(R.id.input_layout_nick_name);
        input_layout_password = (TextInputLayout) view.findViewById(R.id.input_layout_password);
        btnInvestorProfileSubmit = (Button) view.findViewById(R.id.btnInvestorSubmit);
        btnPersonalProfileSubmit = (Button) view.findViewById(R.id.btnPersonalProfileSubmit);
        btnPersonalProfileSubmit.setOnClickListener(this);
        btnInvestorProfileSubmit.setOnClickListener(this);
        chkNickName = (CheckBox) view.findViewById(R.id.chkOnOff);

        final boolean ischecked = Utils.sharedPreferences.getBoolean(Constants.NICKNAME_CHECKED, false);
        if (ischecked == true) {
            chkNickName.setChecked(true);
        } else {
            chkNickName.setChecked(false);
        }

        chkNickName.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (isChecked) {
                    inputLayout_NickName.setVisibility(View.GONE);
                } else {
                    inputLayout_NickName.setVisibility(View.VISIBLE);
                }
            }
        });

        lytContentInvestor.setVisibility(View.GONE);
        lytContentPersonal.setVisibility(View.VISIBLE);

        alstNetLiquiedCapital = new ArrayList<>();
        alstTaxFillingStatus = new ArrayList<>();
        alstRetirementAge = new ArrayList<>();
        alstFirstChildAge = new ArrayList<>();
        alstSecondChild = new ArrayList<>();
        alstSeletedChild = new ArrayList<>();
        inItInvestorProfile();
        if (!Utils.checkInternetConnection(getActivity())) {
            Utils.SimpleAlertMessage(getActivity(), getResources().getString(R.string.internet_not_found));
        } else {
            pd.setVisibility(View.VISIBLE);
            getIndustry();
        }
    }

    public void inItInvestorProfile() {
        txtAddChild = (TextView) view.findViewById(R.id.txtAddChild);
        txtAddChild.setOnClickListener(this);
        txtShortTerm = (TextView) view.findViewById(R.id.txtShortTerm);
        txtShortTerm.setOnClickListener(this);
        txtMidiumTerm = (TextView) view.findViewById(R.id.txtMidiumTerm);
        txtMidiumTerm.setOnClickListener(this);
        txtLongTerm = (TextView) view.findViewById(R.id.txtLongTerm);
        txtLongTerm.setOnClickListener(this);
        imgShortTermDrawble = (ImageView) view.findViewById(R.id.imgShortTermDrawble);
        imgShortTermDrawble.setOnClickListener(this);
        imgMidiumTermDrawable = (ImageView) view.findViewById(R.id.imgMidiumTermDrawable);
        imgMidiumTermDrawable.setOnClickListener(this);
        imgLongTermDrawable = (ImageView) view.findViewById(R.id.imgLongTermDrawable);
        imgLongTermDrawable.setOnClickListener(this);
        imgShortTermDrawble.setBackgroundColor(getResources().getColor(R.color.colorGreenApp));
        imgMidiumTermDrawable.setBackgroundColor(Color.TRANSPARENT);
        imgLongTermDrawable.setBackgroundColor(Color.TRANSPARENT);
        txtShortTerm.setTextColor(getResources().getColor(R.color.colorGreenApp));
        txtMidiumTerm.setTextColor(getResources().getColor(R.color.white_color));
        txtLongTerm.setTextColor(getResources().getColor(R.color.white_color));
        edtIncome = (EditText)view.findViewById(R.id.edt_Income);
        inputLayout_Income = (TextInputLayout)view.findViewById(R.id.input_layout_Income);
        lytSecondChildAge = (LinearLayout) view.findViewById(R.id.lytSecondChildAge);
        lytChild = (LinearLayout) view.findViewById(R.id.lytChild);

        alstNetLiquiedCapital = new ArrayList<>();
        alstTaxFillingStatus = new ArrayList<>();
        alstRetirementAge = new ArrayList<>();
        alstFirstChildAge = new ArrayList<>();
        alstSecondChild = new ArrayList<>();
        alstSeletedChild = new ArrayList<>();
        fillArraylist();

//        spnAnnualIncome = (Spinner) view.findViewById(R.id.spnAnnualIncome);
//        inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
//        aadpAnnualIncome = new ArrayAdapter<String>(getActivity(), R.layout.spinner_item, alstAnnualIncome) {
//            @Override
//            public View getView(int position, View convertView, ViewGroup parent) {
//                convertView = inflater.inflate(R.layout.spinner_bg, null);
//                TextView txtIncome = (TextView) convertView.findViewById(R.id.spinnerItem);
//                txtIncome.setText(alstAnnualIncome.get(position).toString());
//                return convertView;
//            }
//
//            @Override
//            public View getDropDownView(int position, View convertView, ViewGroup parent) {
//                convertView = inflater.inflate(R.layout.spinner_item, null);
//                TextView txtIncome = (TextView) convertView.findViewById(R.id.txtItem);
//                txtIncome.setText(alstAnnualIncome.get(position).toString());
//                return convertView;
//            }
//        };
//        spnAnnualIncome.setAdapter(aadpAnnualIncome);

        spnNetLiquidCapital = (Spinner) view.findViewById(R.id.spnNetLiquidCapital);
        aadpNetLiquidCapital = new ArrayAdapter<String>(getActivity(), R.layout.spinner_item, alstNetLiquiedCapital) {
            @Override
            public View getView(int position, View convertView, ViewGroup parent) {
                convertView = inflater.inflate(R.layout.spinner_bg, null);
                TextView textView = (TextView) convertView.findViewById(R.id.spinnerItem);
                textView.setText(alstNetLiquiedCapital.get(position).toString());
                return convertView;
            }

            @Override
            public View getDropDownView(int position, View convertView, ViewGroup parent) {
                convertView = inflater.inflate(R.layout.spinner_item, null);
                TextView textView = (TextView) convertView.findViewById(R.id.txtItem);
                textView.setText(alstNetLiquiedCapital.get(position).toString());
                return convertView;
            }
        };
        spnNetLiquidCapital.setAdapter(aadpNetLiquidCapital);

        spnRetirementAge = (Spinner) view.findViewById(R.id.spnRetirementAge);
        aadpRetirementAge = new ArrayAdapter<String>(getActivity(), R.layout.spinner_item, alstRetirementAge) {
            @Override
            public View getView(int position, View convertView, ViewGroup parent) {
                convertView = inflater.inflate(R.layout.spinner_bg, null);
                TextView textView = (TextView) convertView.findViewById(R.id.spinnerItem);
                textView.setText(alstRetirementAge.get(position).toString());
                return convertView;
            }

            @Override
            public View getDropDownView(int position, View convertView, ViewGroup parent) {
                convertView = inflater.inflate(R.layout.spinner_item, null);
                TextView textView = (TextView) convertView.findViewById(R.id.txtItem);
                textView.setText(alstRetirementAge.get(position).toString());
                return convertView;
            }
        };
        spnRetirementAge.setAdapter(aadpRetirementAge);

        spnTaxFillingStatus = (Spinner) view.findViewById(R.id.spnTaxFillingStatus);
        aadpTaxFillingStatus = new ArrayAdapter<String>(getActivity(), R.layout.spinner_item, alstTaxFillingStatus) {
            @Override
            public View getView(int position, View convertView, ViewGroup parent) {
                convertView = inflater.inflate(R.layout.spinner_bg, null);
                TextView textView = (TextView) convertView.findViewById(R.id.spinnerItem);
                textView.setText(alstTaxFillingStatus.get(position).toString());
                return convertView;
            }

            @Override
            public View getDropDownView(int position, View convertView, ViewGroup parent) {
                convertView = inflater.inflate(R.layout.spinner_item, null);
                TextView textView = (TextView) convertView.findViewById(R.id.txtItem);
                textView.setText(alstTaxFillingStatus.get(position).toString());
                return convertView;
            }
        };
        spnTaxFillingStatus.setAdapter(aadpTaxFillingStatus);

        spnFirstChildAge = (Spinner) view.findViewById(R.id.spnFirstChildAge);
        aadpFirstChildAge = new ArrayAdapter<String>(getActivity(), R.layout.spinner_item, alstFirstChildAge) {
            @Override
            public View getView(int position, View convertView, ViewGroup parent) {
                convertView = inflater.inflate(R.layout.spinner_bg, null);
                TextView textView = (TextView) convertView.findViewById(R.id.spinnerItem);
                textView.setText(alstFirstChildAge.get(position).toString());
                return convertView;
            }

            @Override
            public View getDropDownView(int position, View convertView, ViewGroup parent) {
                convertView = inflater.inflate(R.layout.spinner_item, null);
                TextView textView = (TextView) convertView.findViewById(R.id.txtItem);
                textView.setText(alstFirstChildAge.get(position).toString());
                return convertView;
            }
        };
        spnFirstChildAge.setAdapter(aadpFirstChildAge);

        radioGroupLeverage = (RadioGroup) view.findViewById(R.id.radioGroupLeverage);
        radioGroupChild = (RadioGroup) view.findViewById(R.id.radioGroupChild);
        rbtnLeverageYes = (RadioButton) view.findViewById(R.id.rbtnLeverageYes);
        rbtnLeverageNo = (RadioButton) view.findViewById(R.id.rbtLeveragenNo);
        rbtnChildYes = (RadioButton) view.findViewById(R.id.rbtnChildYes);
        rbtnChildYes.setChecked(true);
        rbtnChildNo = (RadioButton) view.findViewById(R.id.rbtnChildNo);
        radioGroupLeverage.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                if (checkedId == 0) {
                    strLeverage = "YES";
                } else {
                    strLeverage = "NO";
                }
            }
        });

        radioGroupChild.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup radioGroup, int i) {
                int index_selected = radioGroup.indexOfChild(radioGroup.findViewById(radioGroup.getCheckedRadioButtonId()));
                Log.e("", "index:::" + index_selected);
                if (index_selected == 0) {
                    isChild = true;
                    lytChild.setVisibility(View.VISIBLE);

                } else if (index_selected == 1) {
                    isChild = false;
                    lytChild.setVisibility(View.GONE);
                }
            }
        });
    }

    public void InItCircle() {
        circleTech = (CircleDisplay) view.findViewById(R.id.circleTech);
        circleTech.setAnimDuration(4000);
        circleTech.setValueWidthPercent(10f);
        circleTech.setFormatDigits(0);
        circleTech.setDimAlpha(80);
        circleTech.setSelectionListener(this);
        circleTech.setTouchEnabled(false);
        circleTech.setUnit("%");
        circleTech.setStepSize(0.5f);
        circleTech.showValue(70f, 100f, true);
        circleTech.setColor(getResources().getColor(R.color.colorGreenApp));

        circleHealthCare = (CircleDisplay) view.findViewById(R.id.circleHealthCare);
        circleHealthCare.setAnimDuration(4000);
        circleHealthCare.setValueWidthPercent(10f);
        circleHealthCare.setFormatDigits(0);
        circleHealthCare.setDimAlpha(80);
        circleHealthCare.setSelectionListener(this);
        circleHealthCare.setTouchEnabled(false);
        circleHealthCare.setUnit("%");
        circleHealthCare.setStepSize(0.5f);
        circleHealthCare.showValue(70f, 100f, true);
        circleHealthCare.setColor(getResources().getColor(R.color.colorGreenApp));

        circleUtilities = (CircleDisplay) view.findViewById(R.id.circleUtilities);
        circleUtilities.setAnimDuration(4000);
        circleUtilities.setValueWidthPercent(10f);
        circleUtilities.setFormatDigits(0);
        circleUtilities.setDimAlpha(80);
        circleUtilities.setSelectionListener(this);
        circleUtilities.setTouchEnabled(false);
        circleUtilities.setUnit("%");
        circleUtilities.setStepSize(0.5f);
        circleUtilities.showValue(70f, 100f, true);
        circleUtilities.setColor(getResources().getColor(R.color.colorGreenApp));
    }

    public void getIndustry() {
        RestClient.get().getIndustry(new Callback<IndustryList>() {
            @Override
            public void success(IndustryList getIndustryResponsePojo, Response response) {
                for (int i = 0; i < getIndustryResponsePojo.getIndustries().size(); i++) {
                    alstIndustryName.add(getIndustryResponsePojo.getIndustries().get(i).getName());
                }
                inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                aadpIndustryName = new ArrayAdapter<String>(getActivity(), R.layout.spinner_item, alstIndustryName) {
                    @Override
                    public View getView(int position, View convertView, ViewGroup parent) {
                        convertView = inflater.inflate(R.layout.spinner_bg, null);
                        TextView txtIndustry = (TextView) convertView.findViewById(R.id.spinnerItem);
                        txtIndustry.setText(alstIndustryName.get(position).toString());
                        return convertView;
                    }

                    @Override
                    public View getDropDownView(int position, View convertView, ViewGroup parent) {
                        convertView = inflater.inflate(R.layout.spinner_item, null);
                        intIndustryPos = position;
                        TextView txtIndustry = (TextView) convertView.findViewById(R.id.txtItem);
                        txtIndustry.setText(alstIndustryName.get(position).toString());
                        return convertView;
                    }
                };
                spnIndustry.setAdapter(aadpIndustryName);
                getProfile();
            }

            @Override
            public void failure(RetrofitError error) {
//                if (pd != null && pd.isShowing()) {
//                    pd.dismiss();
//                }
//                error.printStackTrace();
                try {
                    if (error.getCause() != null) {
                        if (error.getCause().toString().contains("java.io.IOException")) {
                            if (!Utils.checkInternetConnection(getActivity())) {
                                pd.setVisibility(View.GONE);
                                Utils.SimpleAlertMessage(getActivity(), getActivity().getResources().getString(R.string.internet_not_found));
                            } else {
                                getIndustry();
                            }
                        } else if (error.getCause().toString().contains("java.net.SocketTimeoutException")) {
                            pd.setVisibility(View.GONE);
                            Toast.makeText(getActivity(), "Timeout occured.. Please try again", Toast.LENGTH_LONG).show();
                        }
                    } else {
                        pd.setVisibility(View.GONE);
                        String json = new String(((TypedByteArray) error.getResponse().getBody()).getBytes());
                        Log.v("failure", json.toString());
                        GeneralResponsePojo generalResponsePojo = gson.fromJson(json, GeneralResponsePojo.class);
                        Toast.makeText(getActivity(), generalResponsePojo.getMessage().toString(), Toast.LENGTH_LONG).show();
                    }
                    Log.e("Failure response", error.toString());

                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }

    public void SetSpinnerSelection(Spinner spinner, ArrayList<String> arrayList, int text) {
        for (int i = 0; i < arrayList.size(); i++) {
            if (arrayList.get(i).equals(String.valueOf(text))) {
                spinner.setSelection(i);
            }
        }
    }

    public void SetSpinnerStringSelection(Spinner spinner, ArrayList<String> arrayList, String text) {
        for (int i = 0; i < arrayList.size(); i++) {
            if (arrayList.get(i).equals(text)) {
                spinner.setSelection(i);
            }
        }
    }

    //Investor
    public void fillArraylist() {
//        alstAnnualIncome.add(getResources().getString(R.string.your_annual_after_tax_income));
//        alstAnnualIncome.add("0");
//        alstAnnualIncome.add("1000");
//        alstAnnualIncome.add("2000");
//        alstAnnualIncome.add("3000");
//        alstAnnualIncome.add("4000");

        alstNetLiquiedCapital.add(getResources().getString(R.string.value_of_your_net_liquid_capita));
        alstNetLiquiedCapital.add("< $50,000");
        alstNetLiquiedCapital.add("$100,000 - $200,000");
        alstNetLiquiedCapital.add("$200,000 - $300,00");
        alstNetLiquiedCapital.add("$300k - $400k");
        alstNetLiquiedCapital.add("$500K - $1M");
        alstNetLiquiedCapital.add("$1M - $10M");
        alstNetLiquiedCapital.add("> $10M");

        alstTaxFillingStatus.add(getResources().getString(R.string.your_tax_filling_status));
        alstTaxFillingStatus.add("MARRIED");
        alstTaxFillingStatus.add("SINGLE");
        alstTaxFillingStatus.add("FAMILY");
        alstTaxFillingStatus.add("SDDFSD");

        alstRetirementAge.add(getResources().getString(R.string.yourexpected_retirement_age));
        alstRetirementAge.add("50");
        alstRetirementAge.add("55");
        alstRetirementAge.add("60");
        alstRetirementAge.add("65");
        alstRetirementAge.add("70");
        alstRetirementAge.add("75");
        alstRetirementAge.add("80");
        alstRetirementAge.add("85");

        alstFirstChildAge.clear();
        alstFirstChildAge.add(getResources().getString(R.string.first_child_age));
        for (int i = 1; i <= 20; i++) {
            alstFirstChildAge.add(String.valueOf(i));
        }

        alstSecondChild.clear();
        alstSecondChild.add(getResources().getString(R.string.second_child_age));
        for (int i = 1; i <= 20; i++) {
            alstSecondChild.add(String.valueOf(i));
        }
    }

    public boolean fieldInvestorValidation() {
        boolean flag = true;
        if (!validateIncome()) {
            flag = false;
        } else if (spnNetLiquidCapital.getSelectedItem().equals(getResources().getString(R.string.value_of_your_net_liquid_capita))) {
            flag = false;
        } else if (spnTaxFillingStatus.getSelectedItem().equals(getResources().getString(R.string.your_tax_filling_status))) {
            flag = false;
        } else if (spnRetirementAge.getSelectedItem().equals(getResources().getString(R.string.yourexpected_retirement_age))) {
            flag = false;
        } else if (spnFirstChildAge.getSelectedItem().equals(getResources().getString(R.string.first_child_age))) {
            flag = false;
        } else if (spnSecondChildAge != null) {
            if (spnSecondChildAge.getSelectedItem().equals(getResources().getString(R.string.second_child_age))) {
                flag = false;
            }
            flag = false;
        }
        return flag;
    }

    public boolean fieldPersonalValidation() {
        boolean flag = true;
        if (!validateEmail()) {
            flag = false;
        }
        if (!validatePassword()) {
            flag = false;
        }
        return flag;
    }

    private boolean validateIncome() {
        if (edtIncome.getText().toString().trim().isEmpty()) {
            inputLayout_Income.setError(getString(R.string.please_enter_Income));
            requestFocus(edtIncome);
            return false;
        } else {
            inputLayout_Income.setErrorEnabled(false);
        }
        return true;
    }

    private boolean validatePassword() {
        if (edtPassword.getText().toString().trim().isEmpty()) {
            input_layout_password.setError(getString(R.string.please_enter_password));
            requestFocus(edtPassword);
            return false;
        } else if (!validate(edtPassword.getText().toString())) {
            input_layout_password.setError(getString(R.string.password_is_short));
            requestFocus(edtPassword);
            return false;
        } else {
            input_layout_password.setErrorEnabled(false);
        }
        return true;
    }

    public static boolean validate(String password) {
        return password.matches("^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9]).{8,}$");
    }

    private void requestFocus(View view) {
        if (view.requestFocus()) {
            getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
        }
    }

    private boolean validateEmail() {
        String email = edtEmail.getText().toString().trim();
        if (email.isEmpty() || !isValidEmail(email)) {
            inputLayout_Email.setError(getString(R.string.please_enter_email));
            requestFocus(edtEmail);
            return false;
        } else {
            inputLayout_Email.setErrorEnabled(false);
        }
        return true;
    }

    private static boolean isValidEmail(String email) {
        return !TextUtils.isEmpty(email) && Patterns.EMAIL_ADDRESS.matcher(email).matches();
    }

    public void dialogChoosePicture() {
        final Dialog dialog = new Dialog(getActivity(), android.R.style.Theme_Dialog);
        dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        dialog.setContentView(R.layout.custom_dialog_choose_video);

        TextView btnGallery = (TextView) dialog.findViewById(R.id.btnLibrary);
        btnGallery.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dialog.dismiss();
                Intent i = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
                startActivityForResult(i, RESULT_LOAD_GALLERY);
            }
        });

        TextView btnCamera = (TextView) dialog.findViewById(R.id.btnCamera);
        btnCamera.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dialog.dismiss();
                Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
                intent.putExtra("android.intent.extras.CAMERA_FACING", 1);
                startActivityForResult(intent, RESULT_LOAD_CAMERA);
            }
        });
        TextView btnCancel = (TextView) dialog.findViewById(R.id.btnCancel);
        btnCancel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dialog.dismiss();
            }
        });
        dialog.show();
    }

    public String saveToInternalSorage(Bitmap bitmapImage, String folderPath, String filename) {
        File directory = getActivity().getDir("images", Context.MODE_PRIVATE);
        directory = new File(directory, folderPath);
        if (!directory.isDirectory())
            directory.mkdirs();
        File mypath = new File(directory, filename);
        try {
            FileOutputStream fos = new FileOutputStream(mypath);
            bitmapImage.compress(Bitmap.CompressFormat.PNG, 100, fos);
            fos.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return mypath.getAbsolutePath();
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == RESULT_LOAD_CAMERA) {
            profile_pic_path = "";
            imgCoverBg.setVisibility(View.VISIBLE);
            Bitmap thumbnail = (Bitmap) data.getExtras().get("data");
            String timestamp = new SimpleDateFormat("dd-mm-yyyy_HH:mm:ss").format(new Date());
            folder_path_profile = getResources().getString(R.string.app_name);
            file_path_profile = timestamp + "profile_pic.png";
            profile_pic_path = saveToInternalSorage(thumbnail, folder_path_profile, file_path_profile);
            Glide.with(this).load(new File(profile_pic_path)).asBitmap().override(150, 150).centerCrop().into(new BitmapImageViewTarget(imgProfile) {
                @Override
                protected void setResource(Bitmap resource) {
                    RoundedBitmapDrawable circularBitmapDrawable =
                            RoundedBitmapDrawableFactory.create(getResources(), resource);
                    circularBitmapDrawable.setCircular(true);
                    imgProfile.setImageDrawable(circularBitmapDrawable);
                }
            });

            Glide.with(this).load(new File(profile_pic_path)).centerCrop().into(imgCover);
            Log.e("", "profile_pic_path:::" + profile_pic_path);

        } else if (requestCode == RESULT_LOAD_GALLERY && resultCode == Activity.RESULT_OK && null != data) {
            profile_pic_path = "";
            imgCoverBg.setVisibility(View.VISIBLE);
            mImageProfilePicUri = data.getData();
            String[] filePathColumn = {MediaStore.Images.Media.DATA};
            Cursor cursor = getActivity().getContentResolver().query(mImageProfilePicUri, filePathColumn, null, null, null);
            cursor.moveToFirst();
            int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
            profile_pic_path = cursor.getString(columnIndex);
            cursor.close();

            final File profile = new File(profile_pic_path);
            Log.i("System out", "Profile Pic PAth : " + profile.getAbsolutePath());
            Glide.with(this).load(profile).asBitmap().override(150, 150).centerCrop().into(new BitmapImageViewTarget(imgProfile) {
                @Override
                protected void setResource(Bitmap resource) {
                    RoundedBitmapDrawable circularBitmapDrawable =
                            RoundedBitmapDrawableFactory.create(getResources(), resource);
                    circularBitmapDrawable.setCircular(true);
                    imgProfile.setImageDrawable(circularBitmapDrawable);
                }
            });
            Glide.with(this).load(profile).centerCrop().into(imgCover);
        }
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.txtPersonalProfile:
                txtPersonalProfile.setTextColor(getResources().getColor(R.color.colorGreenApp));
                txtinvestorProfile.setTextColor(getResources().getColor(R.color.white_color));
                lytContentInvestor.setVisibility(View.GONE);
                lytContentPersonal.setVisibility(View.VISIBLE);
                if (!Utils.checkInternetConnection(getActivity())) {
                    Utils.SimpleAlertMessage(getActivity(), getResources().getString(R.string.internet_not_found));
                } else {
                    pd.setVisibility(View.VISIBLE);
                    getProfile();
                }
                break;

            case R.id.txtinvestorProfile:
                txtPersonalProfile.setTextColor(getResources().getColor(R.color.white_color));
                txtinvestorProfile.setTextColor(getResources().getColor(R.color.colorGreenApp));
                lytContentInvestor.setVisibility(View.VISIBLE);
                lytContentPersonal.setVisibility(View.GONE);
                if (!Utils.checkInternetConnection(getActivity())) {
                    Utils.SimpleAlertMessage(getActivity(), getResources().getString(R.string.internet_not_found));
                } else {
                    pd.setVisibility(View.VISIBLE);
                    getInvestor();
                }
                break;

            case R.id.imgEdit:
                dialogChoosePicture();
                break;

            case R.id.txtAddChild:
                lytSecondChildAge.setVisibility(View.VISIBLE);
                spnSecondChildAge = (Spinner) view.findViewById(R.id.spnSeconChildAge);
                aadpSecondChildAge = new ArrayAdapter<String>(getActivity(), R.layout.spinner_item, alstSecondChild) {
                    @Override
                    public View getView(int position, View convertView, ViewGroup parent) {
                        convertView = inflater.inflate(R.layout.spinner_bg, null);
                        TextView textView = (TextView) convertView.findViewById(R.id.spinnerItem);
                        textView.setText(alstSecondChild.get(position).toString());
                        return convertView;
                    }

                    @Override
                    public View getDropDownView(int position, View convertView, ViewGroup parent) {
                        convertView = inflater.inflate(R.layout.spinner_item, null);
                        TextView textView = (TextView) convertView.findViewById(R.id.txtItem);
                        textView.setText(alstSecondChild.get(position).toString());
                        strSecondChildAge = alstSecondChild.get(position).toString();
                        //alstSeletedChild.add(alstSecondChild.get(position).toString());
                        return convertView;
                    }
                };
                spnSecondChildAge.setAdapter(aadpSecondChildAge);
                txtAddChild.setVisibility(View.GONE);
                break;

            case R.id.imgShortTermDrawble:
                strInvesmentHorizon = "short-term";
                imgShortTermDrawble.setBackgroundColor(getResources().getColor(R.color.colorGreenApp));
                imgMidiumTermDrawable.setBackgroundColor(Color.TRANSPARENT);
                imgLongTermDrawable.setBackgroundColor(Color.TRANSPARENT);
                txtShortTerm.setTextColor(getResources().getColor(R.color.colorGreenApp));
                txtMidiumTerm.setTextColor(getResources().getColor(R.color.white_color));
                txtLongTerm.setTextColor(getResources().getColor(R.color.white_color));
                break;

            case R.id.imgMidiumTermDrawable:
                strInvesmentHorizon = "medium-term";
                imgShortTermDrawble.setBackgroundColor(Color.TRANSPARENT);
                imgMidiumTermDrawable.setBackgroundColor(getResources().getColor(R.color.colorGreenApp));
                imgLongTermDrawable.setBackgroundColor(Color.TRANSPARENT);
                txtShortTerm.setTextColor(getResources().getColor(R.color.white_color));
                txtMidiumTerm.setTextColor(getResources().getColor(R.color.colorGreenApp));
                txtLongTerm.setTextColor(getResources().getColor(R.color.white_color));
                break;

            case R.id.imgLongTermDrawable:
                strInvesmentHorizon = "long-term";
                imgShortTermDrawble.setBackgroundColor(Color.TRANSPARENT);
                imgMidiumTermDrawable.setBackgroundColor(Color.TRANSPARENT);
                imgLongTermDrawable.setBackgroundColor(getResources().getColor(R.color.colorGreenApp));
                txtShortTerm.setTextColor(getResources().getColor(R.color.white_color));
                txtMidiumTerm.setTextColor(getResources().getColor(R.color.white_color));
                txtLongTerm.setTextColor(getResources().getColor(R.color.colorGreenApp));
                break;

            case R.id.txtShortTerm:
                strInvesmentHorizon = "short-term";
                imgShortTermDrawble.setBackgroundColor(getResources().getColor(R.color.colorGreenApp));
                imgMidiumTermDrawable.setBackgroundColor(Color.TRANSPARENT);
                imgLongTermDrawable.setBackgroundColor(Color.TRANSPARENT);
                txtShortTerm.setTextColor(getResources().getColor(R.color.colorGreenApp));
                txtMidiumTerm.setTextColor(getResources().getColor(R.color.white_color));
                txtLongTerm.setTextColor(getResources().getColor(R.color.white_color));
                break;

            case R.id.txtMidiumTerm:
                strInvesmentHorizon = "medium-term";
                imgShortTermDrawble.setBackgroundColor(Color.TRANSPARENT);
                imgMidiumTermDrawable.setBackgroundColor(getResources().getColor(R.color.colorGreenApp));
                imgLongTermDrawable.setBackgroundColor(Color.TRANSPARENT);
                txtShortTerm.setTextColor(getResources().getColor(R.color.white_color));
                txtMidiumTerm.setTextColor(getResources().getColor(R.color.colorGreenApp));
                txtLongTerm.setTextColor(getResources().getColor(R.color.white_color));
                break;

            case R.id.txtLongTerm:
                strInvesmentHorizon = "long-term";
                imgShortTermDrawble.setBackgroundColor(Color.TRANSPARENT);
                imgMidiumTermDrawable.setBackgroundColor(Color.TRANSPARENT);
                imgLongTermDrawable.setBackgroundColor(getResources().getColor(R.color.colorGreenApp));
                txtShortTerm.setTextColor(getResources().getColor(R.color.white_color));
                txtMidiumTerm.setTextColor(getResources().getColor(R.color.white_color));
                txtLongTerm.setTextColor(getResources().getColor(R.color.colorGreenApp));
                break;

            case R.id.btnInvestorSubmit:
                if (!Utils.checkInternetConnection(getActivity())) {
                    Utils.SimpleAlertMessage(getActivity(), getResources().getString(R.string.internet_not_found));
                } else {
                    if (fieldInvestorValidation()) {
                        if (!Utils.checkInternetConnection(getActivity())) {
                            Utils.SimpleAlertMessage(getActivity(), getResources().getString(R.string.internet_not_found));
                        } else {
                            pd.setVisibility(View.VISIBLE);
                            callUpdateInvestorService();
                        }
                    }
                }
                break;

            case R.id.btnPersonalProfileSubmit:
                if (fieldPersonalValidation()) {
                    strFirstName = edtFirstName.getText().toString().trim();
                    strLastName = edtLastName.getText().toString().trim();
                    strEmail = edtEmail.getText().toString().trim();
                    if (edtNick_name != null) {
                        strNickName = edtNick_name.getText().toString();
                    }
                    Log.e("", "strFirstName::::" + strFirstName);
                    String industry = spnIndustry.getSelectedItem().toString();
                    if (!Utils.checkInternetConnection(getActivity())) {
                        Utils.SimpleAlertMessage(getActivity(), getResources().getString(R.string.internet_not_found));
                    } else {
                        pd.setVisibility(View.VISIBLE);
                        callPersonalProfileService(strGender, strFirstName, strLastName, strEmail, edtPassword.getText().toString(), edtPassword.getText().toString(), industry, strBirthDate, profile_pic_path, strLocation, strDeviceToken);
                    }
                }
                break;

            case R.id.lytActivity:
                ((HomeActivity) getActivity()).callActivitiesMenu();
                break;

            case R.id.lytIdeas:
                ((HomeActivity) getActivity()).callIdeasMenu();
                break;

            case R.id.lytWatchList:
                ((HomeActivity) getActivity()).callWatchlistMenu();
                break;

            case R.id.lytSetting:
                ((HomeActivity) getActivity()).callSettings();

                break;
        }
    }

    @Override
    public void onSelectionUpdate(float val, float maxval) {
        Log.i("Main", "Selection update: " + val + ", max: " + maxval);
    }

    @Override
    public void onValueSelected(float val, float maxval) {
        Log.i("Main", "Selection complete: " + val + ", max: " + maxval);
    }

    public void isStoragePermissionGranted() {
        if (Build.VERSION.SDK_INT >= 23) {
            if ((getActivity().checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)
                    == PackageManager.PERMISSION_GRANTED) && (getActivity().checkSelfPermission(Manifest.permission.CAMERA)
                    == PackageManager.PERMISSION_GRANTED) && (getActivity().checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE)
                    == PackageManager.PERMISSION_GRANTED)) {
                Log.v("", "Permission is granted");
                dialogChoosePicture();
            } else {
                if (!ActivityCompat.shouldShowRequestPermissionRationale(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE) || !ActivityCompat.shouldShowRequestPermissionRationale(getActivity(), Manifest.permission.CAMERA) || !ActivityCompat.shouldShowRequestPermissionRationale(getActivity(), Manifest.permission.READ_EXTERNAL_STORAGE)) {
                    Log.e("Tets", "Never ask again choosen");
                    SimpleAlertSetting(getActivity(), getResources().getString(R.string.please_go_to_setting));
                } else {
                    Log.v("", "Permission is revoked");
                    ActivityCompat.requestPermissions(getActivity(), new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA, Manifest.permission.READ_EXTERNAL_STORAGE}, 1);
                }
            }
        }
    }

    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) {
        switch (requestCode) {
            case REQUEST_PERMISSION_SETTING: {
                Map<String, Integer> perms = new HashMap<>();
                perms.put(Manifest.permission.CAMERA, PackageManager.PERMISSION_GRANTED);
                perms.put(Manifest.permission.WRITE_EXTERNAL_STORAGE, PackageManager.PERMISSION_GRANTED);
                if (grantResults.length > 0) {
                    for (int i = 0; i < permissions.length; i++)
                        perms.put(permissions[i], grantResults[i]);
                    if (perms.get(Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED
                            && perms.get(Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
                        // process the normal flow
                        //else any one or both the permissions are not granted
                        dialogChoosePicture();
                        //  startActivityForResult(dialogChoosePicture(), 200);
                    } else {
                        //permission is denied (this is the first time, when "never ask again" is not checked) so ask again explaining the usage of permission
//                        // shouldShowRequestPermissionRationale will return true
                        //show the dialog or snackbar saying its necessary and try again otherwise proceed with setup.
                        if (ActivityCompat.shouldShowRequestPermissionRationale(getActivity(), Manifest.permission.CAMERA) || ActivityCompat.shouldShowRequestPermissionRationale(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
                            showPermissionDialog("App requires permissions for camera and storage to access media files", "Ok", "Cancel", new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    Log.e("permission dialog", "request perm settings which was clicked : " + which);
                                    checkAndRequestPermissions();
                                }
                            });
                        }
                        //permission is denied (and never ask again is  checked)
                        //shouldShowRequestPermissionRationale will return false
                        else {
                            showPermissionDialog("App requires permission for camera and storage to access media files", "Go to settings", "Cancel", new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    Log.e("permission dialog", "request perm settings which was clicked : " + which);
                                    Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
                                    Uri uri = Uri.fromParts("package", getActivity().getPackageName(), null);
                                    intent.setData(uri);
                                    startActivityForResult(intent, REQUEST_SETTING);
                                }
                            });                          //proceed with logic by disabling the related features or quit the app.
                        }
                    }
                }
            }
        }
    }

    private boolean checkAndRequestPermissions() {
        int permissionSendMessage = ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.CAMERA);
        int locationPermission = ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE);
        List<String> listPermissionsNeeded = new ArrayList<>();
        if (locationPermission != PackageManager.PERMISSION_GRANTED) {
            listPermissionsNeeded.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
        }
        if (permissionSendMessage != PackageManager.PERMISSION_GRANTED) {
            listPermissionsNeeded.add(Manifest.permission.CAMERA);
        }
        if (!listPermissionsNeeded.isEmpty()) {
            ActivityCompat.requestPermissions(getActivity(), listPermissionsNeeded.toArray(new String[listPermissionsNeeded.size()]), REQUEST_PERMISSION_SETTING);
            return false;
        }
        return true;
    }

    private void showPermissionDialog(String message, String posBtnTxt, String negBtnTxt, DialogInterface.OnClickListener okListener) {
        new AlertDialog.Builder(getActivity())
                .setMessage(message)
                .setPositiveButton(posBtnTxt, okListener)
                .setNegativeButton(negBtnTxt, null)
                .create()
                .show();
    }

    public void SimpleAlertSetting(final Context _this, String msg) {
        AlertDialog.Builder builder = new AlertDialog.Builder(_this);
        builder.setMessage(msg);
        builder.setPositiveButton(_this.getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                dialog.cancel();
                Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
                Uri uri = Uri.fromParts("package", _this.getPackageName(), null);
                intent.setData(uri);
                startActivityForResult(intent, REQUEST_PERMISSION_SETTING);

            }
        });
        AlertDialog alert11 = builder.show();
        alert11.show();
    }

    public void decodeBase64String(String strBase64) {
        if (Utils.validateString(strBase64)) {
            if (strBase64.length() > 23) {
                byte[] decodedString = Base64.decode(strBase64.substring(22), Base64.DEFAULT);

                Glide.with(this).load(decodedString).asBitmap().override(150, 150).centerCrop().error(R.mipmap.profile_base).placeholder(R.mipmap.default_user).into(new BitmapImageViewTarget(imgProfile) {
                    @Override
                    protected void setResource(Bitmap resource) {
                        RoundedBitmapDrawable circularBitmapDrawable =
                                RoundedBitmapDrawableFactory.create(getResources(), resource);
                        circularBitmapDrawable.setCircular(true);
                        imgProfile.setImageDrawable(circularBitmapDrawable);
                    }
                });
                Glide.with(this).load(decodedString).centerCrop().error(R.mipmap.profile_base).placeholder(R.mipmap.profile_base).into(imgCover);
            }
        }
    }

    public void callPersonalProfileService(final String gender, final String firstName, final String lastName, final String email, final String password, final String passwordAgain,
                                           final String industry, final String birthday, final String picturepath, final String location, final String deviceTokenID) {
        try {
            Log.e("", "" + picturepath);
            if (Utils.validateString(picturepath)) {
                InputStream inputStream = new FileInputStream(picturepath);
                byte[] bytes;
                byte[] buffer = new byte[8192];
                int bytesRead;
                ByteArrayOutputStream output = new ByteArrayOutputStream();
                try {
                    while ((bytesRead = inputStream.read(buffer)) != -1) {
                        output.write(buffer, 0, bytesRead);
                    }
                } catch (IOException e) {
                    e.printStackTrace();
                }
                bytes = output.toByteArray();
                encodedString = Base64.encodeToString(bytes, Base64.DEFAULT);
                encodedString = "data:image/png;base64," + encodedString;
            } else {
                if(Utils.validateString(strBase64)){
                    encodedString = "data:image/png;base64,"+strBase64;
                }else {
                    encodedString = "";
                }
            }

            JSONObject mJsonObject = new JSONObject();
            mJsonObject.put("gender", gender);
            mJsonObject.put("firstName", firstName);
            mJsonObject.put("lastName", lastName);
            mJsonObject.put("email", email);
            mJsonObject.put("industry", industry);
            mJsonObject.put("birthday", birthday);
            mJsonObject.put("picture", encodedString);
            mJsonObject.put("location", location);
            mJsonObject.put("deviceTokenID", deviceTokenID);
            mJsonObject.put("nickname", strNickName);
            mJsonObject.put("profession", edtProfession.getText().toString());
            JSONObject data = new JSONObject();
            data.put("user", mJsonObject);
            Log.e("", "data::::" + data.toString());

            String bodyString = data.toString();
            TypedInput requestBody = new TypedByteArray("application/json", bodyString.getBytes(Charset.forName("UTF-8")));
            //Defining the method insertuser of our interfaces
            RestClient.get().UpdatePersonalProfile(sessionManager.getUSER_ID(), sessionManager.getTOKEN(),
                    //"Basic Og==",
                    requestBody,
                    new Callback<Response>() {
                        @Override
                        public void success(Response result, Response response) {
                            BufferedReader reader = null;
                            //An string to store output from the server
                            String strResponse = "";
                            try {
                                reader = new BufferedReader(new InputStreamReader(result.getBody().in()));
                                //Reading the output in the string
                                String a = null;
                                while ((a = reader.readLine()) != null) {
                                    strResponse = strResponse + a;
                                }
                            } catch (IOException e) {
                                e.printStackTrace();
                            }
                            Log.e("Success response", strResponse);
                            try {
                                Toast.makeText(getActivity(), "Personal profile updated successfully", Toast.LENGTH_LONG).show();
                                Intent mIntent = new Intent(getActivity(), HomeActivity.class);
                                startActivity(mIntent);
                                getActivity().finish();
                                JSONObject mJsonObject = new JSONObject(strResponse);
                                Utils.storeInt(Constants.VERSION, mJsonObject.getInt("version"));
                                Utils.storeString(Constants.TRANSACTION_ID, mJsonObject.getString("transaction_id"));
                                Log.e("", "VERSION" + mJsonObject.getInt("version"));
                                Log.e("", "TRANSACTION_ID::::" + mJsonObject.getString("transaction_id"));
                                pd.setVisibility(View.GONE);
                            } catch (JSONException e) {
                            }
                        }

                        @Override
                        public void failure(RetrofitError error) {
                            //If any error occured displaying the error as toast
                            try {
                                if (error.getCause() != null) {
                                    if (error.getCause().toString().contains("java.io.IOException")) {
                                        if (!Utils.checkInternetConnection(getActivity())) {
                                            pd.setVisibility(View.GONE);
                                            Utils.SimpleAlertMessage(getActivity(), getActivity().getResources().getString(R.string.internet_not_found));
                                        } else {
                                            callPersonalProfileService(gender, firstName, lastName, email, password, passwordAgain, industry, birthday, picturepath, location, deviceTokenID);
                                        }
                                    } else if (error.getCause().toString().contains("java.net.SocketTimeoutException")) {
                                        pd.setVisibility(View.GONE);
                                        Toast.makeText(getActivity(), "Timeout occured.. Please try again", Toast.LENGTH_LONG).show();
                                    }
                                } else {
                                    pd.setVisibility(View.GONE);
                                    String json = new String(((TypedByteArray) error.getResponse().getBody()).getBytes());
                                    Log.v("failure", json.toString());
                                    GeneralResponsePojo generalResponsePojo = gson.fromJson(json, GeneralResponsePojo.class);
                                    Toast.makeText(getActivity(), generalResponsePojo.getMessage().toString(), Toast.LENGTH_LONG).show();

                                }
                                Log.e("Failure response", error.toString());

                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                        }
                    }
            );
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


    public void callUpdateInvestorService() {
        try {
            JSONObject mInput = new JSONObject();
            JSONObject mJsonObjectInput = new JSONObject();
            JSONArray mJsonArrayChild = new JSONArray();
            JSONObject childObj = new JSONObject();
            if (!spnFirstChildAge.getSelectedItem().equals(spnFirstChildAge.getSelectedItem().equals(getResources().getString(R.string.please_add_first_child_age)))) {
                childObj.put("age", Integer.parseInt(String.valueOf(spnFirstChildAge.getSelectedItem())));
                mJsonArrayChild.put(childObj);
            }

            JSONObject childObj1 = new JSONObject();
            if (spnSecondChildAge != null) {
                if (!spnSecondChildAge.getSelectedItem().equals(spnSecondChildAge.getSelectedItem().equals(getResources().getString(R.string.please_add_second_child_age)))) {
                    childObj1.put("age", Integer.parseInt(String.valueOf(spnSecondChildAge.getSelectedItem())));
                    mJsonArrayChild.put(childObj1);
                }
            }

            if (Utils.validateString(edtIncome.getText().toString().trim())) {
                strAnnualIncome = edtIncome.getText().toString().trim();
            }

            if (spnNetLiquidCapital != null) {
                if (!spnNetLiquidCapital.getSelectedItem().equals(getResources().getString(R.string.value_of_your_net_liquid_capita))) {
                    strNetLiquidCapital = spnNetLiquidCapital.getSelectedItem().toString();
                }
            }
            if (spnTaxFillingStatus != null) {
                if (!spnTaxFillingStatus.getSelectedItem().equals(getResources().getString(R.string.your_tax_filling_status))) {
                    strTaxFillingStatus = spnTaxFillingStatus.getSelectedItem().toString();
                }
            }
            if (spnRetirementAge != null) {
                if (!spnRetirementAge.getSelectedItem().equals(getResources().getString(R.string.yourexpected_retirement_age))) {
                    strRetirementAge = spnRetirementAge.getSelectedItem().toString();
                }
            }

            JSONObject mJsonObjectHouseHold = new JSONObject();
            mJsonObjectHouseHold.put("id", 4);
            mJsonObjectHouseHold.put("name", "xxxx");
            mJsonObjectInput.put("household", mJsonObjectHouseHold);
            mJsonObjectInput.put("child", mJsonArrayChild);
            mJsonObjectInput.put("income", edtIncome.getText().toString().trim());
            mJsonObjectInput.put("cashAndLiquid", spnNetLiquidCapital.getSelectedItem());
            mJsonObjectInput.put("leverage", strLeverage);
            mJsonObjectInput.put("investmentStyle", strInvesmentHorizon);
            mJsonObjectInput.put("taxFillingStatus", spnTaxFillingStatus.getSelectedItem());
            mJsonObjectInput.put("retirementAge", Integer.parseInt(String.valueOf(spnRetirementAge.getSelectedItem())));
            mInput.put("user", mJsonObjectInput);
            Log.e("", "data::::" + mInput.toString());

            String bodyString = mInput.toString();
            TypedInput requestBody = new TypedByteArray("application/json", bodyString.getBytes(Charset.forName("UTF-8")));
            RestClient.get().UpdateInvestor(
                    //"Basic Og==",
                    requestBody,
                    new Callback<Response>() {
                        @Override
                        public void success(Response result, Response response) {
                            BufferedReader reader = null;
                            //An string to store output from the server
                            String strResponse = "";
                            try {
                                reader = new BufferedReader(new InputStreamReader(result.getBody().in()));
                                //Reading the output in the string
                                String a = null;
                                while ((a = reader.readLine()) != null) {
                                    strResponse = strResponse + a;
                                }
                            } catch (IOException e) {
                                e.printStackTrace();
                            }
                            Log.e("Success response", strResponse);
                            try {
                                Toast.makeText(getActivity(), "Investor profile updated successfully", Toast.LENGTH_LONG).show();
                                JSONObject mJsonObject = new JSONObject(strResponse);
                                Utils.storeInt(Constants.VERSION, mJsonObject.getInt("version"));
                                Utils.storeString(Constants.TRANSACTION_ID, mJsonObject.getString("transaction_id"));
                                Log.e("", "VERSION" + mJsonObject.getInt("version"));
                                Log.e("", "TRANSACTION_ID::::" + mJsonObject.getString("transaction_id"));
                                pd.setVisibility(View.GONE);
////                            Utils.storeString(Constants.TRANSACTION_ID, responsePojo.getTransaction_id());
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                        }

                        @Override
                        public void failure(RetrofitError error) {
//                            if (pd != null && pd.isShowing()) {
//                                pd.dismiss();
//                            }
//                            error.printStackTrace();
                            try {
                                if (error.getCause() != null) {
                                    if (error.getCause().toString().contains("java.io.IOException")) {
                                        if (!Utils.checkInternetConnection(getActivity())) {
                                            pd.setVisibility(View.GONE);
                                            Utils.SimpleAlertMessage(getActivity(), getActivity().getResources().getString(R.string.internet_not_found));
                                        } else {
                                            callUpdateInvestorService();
                                        }
                                    } else if (error.getCause().toString().contains("java.net.SocketTimeoutException")) {
                                        pd.setVisibility(View.GONE);
                                        Toast.makeText(getActivity(), "Timeout occured.. Please try again", Toast.LENGTH_LONG).show();
                                    }
                                } else {
                                    pd.setVisibility(View.GONE);
                                    String json = new String(((TypedByteArray) error.getResponse().getBody()).getBytes());
                                    Log.v("failure", json.toString());
                                    GeneralResponsePojo generalResponsePojo = gson.fromJson(json, GeneralResponsePojo.class);
                                    Toast.makeText(getActivity(), generalResponsePojo.getMessage().toString(), Toast.LENGTH_LONG).show();
                                }
                                Log.e("Failure response", error.toString());
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                        }
                    }
            );
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void getProfile() {
        Log.e("", "Path:::" + Constants.MY_URL);

        RestClient.get().getProfile(sessionManager.getEMAIL(), sessionManager.getTOKEN(), new Callback<Response>() {
            @Override
            public void success(Response result, Response response2) {
                BufferedReader reader = null;
                String strResponse = "";
                try {
                    reader = new BufferedReader(new InputStreamReader(result.getBody().in()));
                    String a = null;
                    while ((a = reader.readLine()) != null) {
                        strResponse = strResponse + a;
                    }
                } catch (IOException e) {
                    e.printStackTrace();
                }
                Log.e("Success response", strResponse);
                try {
                    JSONObject mJsonObject = new JSONObject(strResponse);
                    JSONObject mObjectUser = mJsonObject.getJSONObject("user");
                    UserProfileDataPojo mProfileModel = new UserProfileDataPojo();
                    mProfileModel.setHousehold(mObjectUser.optString("household"));
                    mProfileModel.setDeviceTokenID(mObjectUser.optString("deviceTokenID"));
                    mProfileModel.setProfession(mObjectUser.optString("profession"));
                    mProfileModel.setTrends(mObjectUser.optString("trends"));
                    mProfileModel.setUser_id(mObjectUser.optString("user_id"));
                    mProfileModel.setSocial_activity(mObjectUser.optString("social_activity"));
                    mProfileModel.setRetirement_age(mObjectUser.optString("retirement_age"));
                    mProfileModel.setSource(mObjectUser.optString("source"));
                    mProfileModel.setLocation(mObjectUser.optString("location"));
                    mProfileModel.setIncome(mObjectUser.optString("income"));
                    mProfileModel.setTax_filling_status(mObjectUser.optString("tax_filling_status"));
                    mProfileModel.setHousehold(mObjectUser.optString("email"));
                    mProfileModel.setEmail(mObjectUser.optString("share_profile"));
                    mProfileModel.setBirthday(mObjectUser.optString("birthday"));
                    mProfileModel.setJoin_leagues(mObjectUser.optString("join_leagues"));
                    mProfileModel.setNickname(mObjectUser.optString("nickname"));
                    mProfileModel.setFirstName(mObjectUser.optString("firstName"));
                    mProfileModel.setFollow_activity(mObjectUser.optString("follow_activity"));
                    mProfileModel.setLastName(mObjectUser.optString("lastName"));
                    mProfileModel.setIndustry(mObjectUser.optString("industry"));
                    mProfileModel.setCashAndLiquid(mObjectUser.optString("cashAndLiquid"));
                    mProfileModel.setGender(mObjectUser.optString("gender"));
                    mProfileModel.setExternal_id(mObjectUser.optString("external_id"));
                    if (Utils.validateString(mObjectUser.optString("picture"))) {
                        strBase64 = "";
                        strBase64 = mObjectUser.optString("picture");
                        decodeBase64String(strBase64);
                    }

                    if (Utils.validateString(mObjectUser.optString("firstName"))) {
                        edtFirstName.setText(mObjectUser.optString("firstName"));
                    } else {
                        edtFirstName.setText("");
                    }
                    if (Utils.validateString(mObjectUser.optString("lastName"))) {
                        edtLastName.setText(mObjectUser.optString("lastName"));
                    } else {
                        edtLastName.setText("");
                    }
                    if (Utils.validateString(mObjectUser.optString("email"))) {
                        edtEmail.setText(mObjectUser.optString("email"));
                    } else {
                        edtEmail.setText("");
                    }
                    if (Utils.validateString(mObjectUser.optString("industry"))) {
                        strIndustry = mObjectUser.optString("industry");
                    } else {
                        strIndustry = "";
                    }
                    if (Utils.validateString(strIndustry)) {
                        SetSpinnerStringSelection(spnIndustry, alstIndustryName, strIndustry);
                    }

                    if (Utils.validateString(mObjectUser.optString("profession"))) {
                        edtProfession.setText(mObjectUser.optString("profession"));
                    } else {
                        edtProfession.setText("");
                    }
                    if (Utils.validateString(mObjectUser.optString("location"))) {
                        edtLocation.setText(mObjectUser.optString("location"));
                    } else {
                        edtLocation.setText("");
                    }
                    if (Utils.validateString(mObjectUser.optString("nickname"))) {
                        edtNick_name.setText(mObjectUser.optString("nickname"));
                    } else {
                        edtNick_name.setText("");
                    }

                    txtName.setText("");
                    if (Utils.validateString(mObjectUser.optString("firstName")) && Utils.validateString(mObjectUser.optString("lastName"))) {
                        txtName.setText(mObjectUser.optString("firstName") + mJsonObject.optString("lastName"));
                    } else if (Utils.validateString(mObjectUser.optString("firstName"))) {
                        txtName.setText(mObjectUser.optString("firstName"));
                    } else if (Utils.validateString(mObjectUser.optString("lastName"))) {
                        txtName.setText(mObjectUser.optString("lastName"));
                    }

                    if (Utils.validateString(mObjectUser.optString("profession")) && Utils.validateString(mObjectUser.optString("location"))) {
                        txtLocation.setText(mObjectUser.optString("profession") + mJsonObject.optString("location"));
                    } else if (Utils.validateString(mObjectUser.optString("profession"))) {
                        txtLocation.setText(mObjectUser.optString("profession"));
                    } else if (Utils.validateString(mObjectUser.optString("location"))) {
                        txtLocation.setText(mObjectUser.optString("location"));
                    }

                    strGender = mObjectUser.optString("gender");
                    strBirthDate = mObjectUser.optString("birthday");
                    strLocation = mObjectUser.optString("location");
                    strDeviceToken = mObjectUser.optString("deviceTokenID");
                    strProfession = mObjectUser.optString("profession");
                    strNickName = mObjectUser.optString("nickname");
                    strPicturePath = mObjectUser.optString("picture");
                    strIndustry = mObjectUser.optString("industry");

                    pd.setVisibility(View.GONE);
                } catch (JSONException e) {

                }
            }

            @Override
            public void failure(RetrofitError error) {
//                if (pd != null && pd.isShowing()) {
//                    pd.dismiss();
//                }
//                Log.e("Respo", "Failure :::" + error.toString());
                try {
                    if (error.getCause() != null) {
                        if (error.getCause().toString().contains("java.io.IOException")) {
                            if (!Utils.checkInternetConnection(getActivity())) {
                                pd.setVisibility(View.GONE);
                                Utils.SimpleAlertMessage(getActivity(), getActivity().getResources().getString(R.string.internet_not_found));
                            } else {
                                getProfile();
                            }
                        } else if (error.getCause().toString().contains("java.net.SocketTimeoutException")) {
                            pd.setVisibility(View.GONE);
                            Toast.makeText(getActivity(), "Timeout occured.. Please try again", Toast.LENGTH_LONG).show();
                        }
                    } else {
                        pd.setVisibility(View.GONE);
                        String json = new String(((TypedByteArray) error.getResponse().getBody()).getBytes());
                        Log.v("failure", json.toString());
                        GeneralResponsePojo generalResponsePojo = gson.fromJson(json, GeneralResponsePojo.class);
                        Toast.makeText(getActivity(), generalResponsePojo.getMessage().toString(), Toast.LENGTH_LONG).show();
                    }
                    Log.e("Failure response", error.toString());
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }

    public void getInvestor() {
        try {

            Map<String, String> params = new HashMap<String, String>();
            params.put("auth_key", sessionManager.getTOKEN());
            params.put("Content-Type", "application/json");
            RestClient.get().getInvestorProfile(sessionManager.getEMAIL(), params, new Callback<Response>() {
                @Override
                public void success(Response result, Response response2) {
                    BufferedReader reader = null;
                    String strResponse = "";
                    try {
                        reader = new BufferedReader(new InputStreamReader(result.getBody().in()));
                        String a = null;
                        while ((a = reader.readLine()) != null) {
                            strResponse = strResponse + a;
                        }
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                    Log.e("Success response", strResponse);
                    try {
                        JSONObject mJsonObject = new JSONObject(strResponse);
                        JSONObject mObjectUser = mJsonObject.getJSONObject("user");
                        String strPicture = mObjectUser.optString("picture");
                        String strRetirementAge = mObjectUser.optString("retirement_age");
                        String strDeviceTokenId = mObjectUser.optString("deviceTokenID");
                        String strserId = mObjectUser.optString("user_id");
                        String strFollowActivity = mObjectUser.optString("follow_activity");
                        String strFirstName = mObjectUser.optString("firstName");
                        String strIncome = mObjectUser.optString("income");
                        String strLastName = mObjectUser.optString("lastName");
                        String strIndustry = mObjectUser.optString("industry");
                        String strJoinLegues = mObjectUser.optString("join_leagues");
                        String strShareProfile = mObjectUser.optString("share_profile");
                        String strCashLiquide = mObjectUser.optString("cashAndLiquid");
                        String strTrends = mObjectUser.optString("trends");
                        String strBirthday = mObjectUser.optString("birthday");
                        String strLocation = mObjectUser.optString("location");
                        String strGender = mObjectUser.optString("gender");
                        String strTaxFillingStatus = mObjectUser.optString("tax_filling_status");
                        String strSocialActivity = mObjectUser.optString("social_activity");
                        String strHouseHold = mObjectUser.optString("household");
                        String strName = mObjectUser.optString("name");

                        if (Utils.validateString(mObjectUser.optString("picture"))) {
                            strBase64 = "";
                            strBase64 = mObjectUser.optString("picture");
                            decodeBase64String(strBase64);
                        }
                        if (Utils.validateString(strRetirementAge)) {
                            SetSpinnerStringSelection(spnRetirementAge, alstRetirementAge, strRetirementAge);
                        }
                        if (Utils.validateString(strIncome)) {
                            edtIncome.setText(strIncome);
                        }
                        if (Utils.validateString(strCashLiquide)) {
                            SetSpinnerSelection(spnNetLiquidCapital, alstNetLiquiedCapital, Integer.parseInt(strCashLiquide));
                        }
                        if (Utils.validateString(strTaxFillingStatus)) {
                            SetSpinnerStringSelection(spnTaxFillingStatus, alstTaxFillingStatus, strTaxFillingStatus);
                        }

                        txtName.setText("");
                        if (Utils.validateString(strName)) {
                            txtName.setText(strName);
                        } else {
                            txtName.setText("");
                        }
                        if (Utils.validateString(strLocation)) {
                            txtLocation.setText(strLocation);
                        } else {
                            txtLocation.setText("");
                        }
                        pd.setVisibility(View.GONE);
                    } catch (JSONException e) {

                    }
                }

                @Override
                public void failure(RetrofitError error) {
                    try {
                        if (error.getCause() != null) {
                            if (error.getCause().toString().contains("java.io.IOException")) {
                                if (!Utils.checkInternetConnection(getActivity())) {
                                    pd.setVisibility(View.GONE);
                                    Utils.SimpleAlertMessage(getActivity(), getActivity().getResources().getString(R.string.internet_not_found));
                                } else {
                                    getInvestor();
                                }
                            } else if (error.getCause().toString().contains("java.net.SocketTimeoutException")) {
                                pd.setVisibility(View.GONE);
                                Toast.makeText(getActivity(), "Timeout occured.. Please try again", Toast.LENGTH_LONG).show();
                            }
                        } else {
                            pd.setVisibility(View.GONE);
                            String json = new String(((TypedByteArray) error.getResponse().getBody()).getBytes());
                            Log.v("failure", json.toString());
                            GeneralResponsePojo generalResponsePojo = gson.fromJson(json, GeneralResponsePojo.class);
                            Toast.makeText(getActivity(), generalResponsePojo.getMessage().toString(), Toast.LENGTH_LONG).show();
                        }
                        Log.e("Failure response", error.toString());

                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}