-1
public class SplashScreen extends AppCompatActivity {

    ImageView bakgroundImage;
    TextView poweredBy;

    //animation
    Animation sideanim,bottomanim;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

        //hooks
        bakgroundImage=findViewById(R.id.background_img);
        poweredBy=findViewById(R.id.powered_by);

        sideanim = AnimationUtils.loadAnimation(this, R.anim.side_anim);
        bottomanim = AnimationUtils.loadAnimation(this, R.anim.bottom_anim);

        bakgroundImage.setAnimation(sideanim);
        poweredBy.setAnimation(bottomanim);

    }
}
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ImageView.setAnimation(android.view.animation.Animation)' on a null object reference
    at com.ajay.vallyguide.Common.SplashScreen.onCreate
Giorgi Tsiklauri
  • 6,699
  • 7
  • 29
  • 54

0 Answers0