我想與我的申請asynchtask第一顯示啓動畫面之間murge,我開始與飛濺5 Seconde系列,然後asynchtask,我想,當我也開始我的飛濺asynchtask開始加載,這是我的濺代碼:Asynchtask用濺射屏幕
public class SplashActivity extends Activity {
private static String Spsc = SplashActivity.class.getName();
private static long time = 5;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); // Removes notification bar
setContentView(R.layout.splash);
IntentLauncher launcher = new IntentLauncher();
launcher.start();
}
private class IntentLauncher extends Thread {
@Override
public void run() {
try {
Thread.sleep(time*1000);
} catch (Exception e) {
Log.e(Spsc, e.getMessage());
}
Intent intent = new Intent(SplashActivity.this, MainActivity.class);
SplashActivity.this.startActivity(intent);
SplashActivity.this.finish();
}
}
}
,這是從mainActivity我飛濺:
class FetchPosts extends AsyncTask<Void, Void, Void> {
private ProgressDialog progressDialog;
@Override
protected void onPreExecute() {
super.onPreExecute();
progressDialog = ProgressDialog.show(MainActivity.this, "", getString(R.string.loading_message));
}
@Override
protected Void doInBackground(Void... params) {
articles = Services.getPosts(MainActivity.this);
return null;
}
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
progressDialog.dismiss();
}
}
你的問題是什麼?什麼是/不工作? – codeMagic 2013-05-06 16:48:23
這是2項活動,我想在它們之間發起飛濺,並在同一時間asynchtask加載數據。 – Sherlock 2013-05-06 17:11:12
我明白了。我問的是發生什麼事/現在不在運行時發生?我們知道你想要什麼。我們不知道的是沒有用到的東西。此外,可能需要把你的'AsyncTask'作爲一個內部類的'MainActivity'的,如果它是不是已經或至少'MainActivity' – codeMagic 2013-05-06 17:13:16