@Override
  public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;
    if (convertView == null) {
      holder = new ViewHolder();
      convertView = this.inflater.inflate(R.layout.subject_item, parent, false);
      holder.subjectName = (TextView) convertView.findViewById(R.id.subName);
      holder.authorName = (TextView) convertView.findViewById(R.id.subAuthor);
      holder.subjectIcon = (ImageView) convertView.findViewById(R.id.subIcon);
      holder.rowLayout = (LinearLayout) convertView.findViewById(R.id.rowLayout);
      convertView.setTag(holder);
    } else {
      holder = (ViewHolder) convertView.getTag();
    }

    holder.subjectName.setText(subjects.get(position).topicData.title);
    holder.subjectName.setTypeface(PrefUtils.getNexaLight(context));

    if (available) {
      holder.authorName.setVisibility(View.VISIBLE);
      holder.authorName.setText("Authored By : " + subjects.get(position).topicData.id);
      holder.authorName.setTypeface(PrefUtils.getNexaLight(context));
    } else {
      holder.authorName.setVisibility(View.GONE);
    }

    if (imageAvailable) {
      holder.subjectIcon.setVisibility(View.VISIBLE);
      holder.subjectIcon.setImageResource(R.drawable.ic_launcher);
    } else {
      holder.subjectIcon.setVisibility(View.GONE);
    }
    return convertView;
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);
    back = (ImageView) findViewById(R.id.back);
    loginTitle = (TextView) findViewById(R.id.title);
    signIn = (Button) findViewById(R.id.signin);
    registerButton = (Button) findViewById(R.id.register);
    forgetPassword = (TextView) findViewById(R.id.forget);
    username = (EditText) findViewById(R.id.username);
    password = (EditText) findViewById(R.id.password);

    userType = getIntent().getStringExtra("user");
    back.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            finish();
          }
        });

    loginTitle.setText(userType + " Login");
    loginTitle.setTypeface(PrefUtils.getNexaLight(LoginActivity.this));
    username.setTypeface(PrefUtils.getNexaLight(LoginActivity.this));
    password.setTypeface(PrefUtils.getNexaLight(LoginActivity.this));
    signIn.setTypeface(PrefUtils.getNexaLight(LoginActivity.this));
    forgetPassword.setTypeface(PrefUtils.getNexaLight(LoginActivity.this));
    registerButton.setTypeface(PrefUtils.getNexaBold(LoginActivity.this));

    signIn.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            if (validationDone()) {
              callWebService(userEmail, userPassword, userType);
            }
            //                Functions.fireIntent(LoginActivity.this, MyDrawerActivity.class);
          }
        });

    registerButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Intent i = new Intent(LoginActivity.this, RegisterActivity.class);
            i.putExtra("user", userType);
            startActivity(i);
          }
        });

    forgetPassword.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Intent i = new Intent(LoginActivity.this, ForgotPassword.class);
            i.putExtra("user", userType);
            startActivity(i);
          }
        });
  }