I just published my first Android app yesterday. I have not tested on Android 4.0, and my friend just told me that my application is breaking about its Galaxy S2 (4.0.3)
This is crashing after a few seconds in my splash screen activity, these are just a few lines of code, maybe you guys can check it out:
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.splashscreen);
try
{
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
overridePendingTransition(0 , 0);
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) {
} finally {
try
{
}
catch(Exception e)
{
ki(e);
}
stop();
}
}
};
splashTread.start();
}
catch(Exception ex)
{
ki(ex);
}
}
@Override
public void onBackPressed() {
return;
}
public void ki(Exception message)
{
Toast myToast = Toast.makeText(getApplicationContext(), message.toString(), 1);
myToast.show();
}
Works fine on Android 2.3 to 3.1, but I can't figure out what the problem is with 4.0+
Please help thank you!
Edit:
If I remove my thread, everything will be fine. So me a new question ... What's new in streams in 4.0? I just ran a thread that does nothing, and even I got a crash.
source
share