我有上运行ICS 4.0.3线程上的冰淇淋三明治
我所做的APK线程问题,我已经安装了它无论在2.33 SE手机和谷歌Nexus S 4.0.3。
在SE上,apk运行并正在加载,因为它应该是。但是,在Nexus上,我收到了一个错误,我已经关闭它。但是我看到后面的程序正在运行。 我试图从代码中删除线程(加载屏幕,闪屏图片)并在Nexus上再次运行它,并且它可以运行。所以我发现我的问题是在线程上,onCreate线程开始。它从2.33到4.0.3有什么不同?
package my.LigTv.Browser;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;
import android.webkit.WebView;
import android.app.AlertDialog;
public class LigTVBrowserActivity extends Activity {
/** Called when the activity is first created. */
WebView mWebView;
AlertDialog alertDialog;
protected boolean _active = true;
protected int _splashTime = 3000; // time to display the splash screen in ms
int progress = 0;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
final Activity activity = this;
final ProgressDialog progressDialog = new ProgressDialog(activity);
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progressDialog.setMessage("Please wait for the applet to load");
progressDialog.show();
progressDialog.setProgress(0);
activity.setProgress(progress * 1000);
progressDialog.incrementProgressBy(progress);
if(progress == 100 && progressDialog.isShowing())
progressDialog.dismiss();
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();
startActivity(new Intent("my.LigTv.Browser.Starter"));
stop();
}
}
};
splashTread.start();
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
_active = false;
}
return true;
}
}
你能告诉我们从发生错误的堆栈跟踪? – 2012-04-24 11:28:22
我可以上传这个给你吗? – Tirolel 2012-04-24 11:41:48
@LeythHisham编辑你的问题并追加它 – zapl 2012-04-24 11:53:43