-1

The error is:

java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.Object java.util.List.get(int)' on a null object reference

private void animate(final View view, final int value, final String data){
  view
    .animate()
    .alpha(value)
    .scaleX(value)
    .scaleY(value)
    .setDuration(500)
    .setStartDelay(100)
    .setInterpolator(new DecelerateInterpolator())
    .setListener(new Animator.AnimatorListener() {
      @Override
      public void onAnimationStart(Animator animation) {
        if (value == 0 && count<4){
          String option = " ";
          if (count ==0){
            option = list.get(position).getOptionA();
          }else if (count==1){
            option = list.get(position).getOptionB();
          }else if (count==2){
            option = list.get(position).getOptionC();
          }else if (count==3){
            option = list.get(position).getOptionD();
          }
          animate(option_container.getChildAt(count), 0, option);
          count++;
        }
      }

      @Override
      public void onAnimationEnd(Animator animation) {
        //change options
        if (value == 0){
          try {
            ((TextView)view).setText(data);
          }catch (ClassCastException ex){
            ((Button)view).setText(data);
          }
          view.setTag(data);
          animate(view, 1,data);
        }
      }
    }
}

ekremkaraca
  • 1,453
  • 2
  • 18
  • 37

1 Answers1

0

Your error occurs because your list is not initialized. You can read more about NullPointerException here: What is a NullPointerException, and how do I fix it?

Destroyer
  • 785
  • 8
  • 20