I have a LinearLayout
with a few Buttons
and TextViews
. I want my background to flash at timed intervals, say from red to white to red and so on. Right now, I am trying this code, but it gives me a null pointer exception.
LinearLayout ll = (LinearLayout) findViewById(R.layout.activity_main);
Animation anim = new AlphaAnimation(0.0f, 1.0f);
anim.setDuration(50);
anim.setStartOffset(20);
anim.setRepeatMode(Animation.REVERSE);
anim.setRepeatCount(Animation.INFINITE);
ll.startAnimation(anim); // shows null pointer exception at this line
Please help me where am I going wrong?