I'm trying to make a simple animation with a image that iniatially it doesn't appear but after it appears rotating 180 degrees for certain a amount of seconds from the left of the screen. So i made a script inside the onCreate method:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ImageView Bart = (ImageView) findViewById(R.id.bart);
Bart.animate().translationXBy(-3000);
Bart.animate().translationXBy(4000).rotation(180).setDuration(2000);
}
But for some reason i'm getting an error saying that i'm trying to invoke a virtual method on a null object reference.What could be the issue?Thanks