I'm having an issue with 4.x devices with my app. It looks like a thread is making it crash while changing activity (from the splash screen to the real application). Here's a screenshot:
Splash activity code is:
public class Splash extends Activity {
protected boolean _active = true;
protected int _splashTime = 3000; // tempo di permanenza spash screen
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
Thread splashTread = new Thread() {
@Override
public void run() {
try {
int waited = 0;
while(_active && (waited < _splashTime)) {
sleep(100);
if(_active) {
waited += 100;
}
}
} catch(InterruptedException e) {
// do nothing
} finally {
finish();
Intent i = new Intent(Splash.this, Test01Activity.class);
startActivity(i);
stop();
}
}
};
splashTread.start();
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
_active = false;
}
return true;
}
}
Also, the app doens't really crash, as the main activity keeps working in the background (behind the "Unfortunatly, app has stopped working" alert). This problems has only been found in 4.x devices, 2.x and 3.x are all-working. The error is at line 37.