Я делаю приложение, в котором мне нужно реализовать альфа-эффект на заставке, и когда я загружаю изображение, оно дает null pointer exception
. Основная проблема при запуске анимации.Анимация не запускается вообще. Я действительно застрял. Любая помощь будет оценена. Мой код выглядит следующим образом:
public class SplashScreen extends Activity {
private Thread mSplashThread;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
System.out.println("hello");
setContentView(R.layout.splash);
final SplashScreen sPlashScreen = this;
Animation a1 = AnimationUtils.loadAnimation(this, R.anim.alpha);
LinearLayout Ll=(LinearLayout)findViewById(R.id.mainLayoutheader);
System.out.println("hello1");
Ll.startAnimation(a1);
System.out.println("hello2");
// The thread to wait for splash screen events
mSplashThread = new Thread(){
@Override
public void run(){
try {
synchronized(this){
// Wait given period of time or exit on touch
// a.reset();
wait(6000);
}
}
catch(InterruptedException ex){
}
finish();
// Run next activity
Intent intent = new Intent();
intent.setClass(sPlashScreen, Main.class);
startActivity(intent);
stop();
}
};
mSplashThread.start();
}
}
Исключение составляет L1.startAnimation(a1);