int main(int argc, char *argv[]) { QApplication a(argc, argv); a.connect(&a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );// added test for player// The splash screen QSplashScreen *pSplash = new QSplashScreen(); pSplash->setPixmap(QPixmap(":images/Splash.png")); pSplash->show(); pSplash->showMessage("Start ...");// main window MainWindow w; w.setWindowTitle(QObject::tr(" my title")); w.hide();// mainwindow disappearsQTimer::singleShot(3000, pSplash, SLOT(close()));// close splash after 4s QTimer::singleShot(3000, &w, SLOT(slInit()));// mainwindow reappears after 4s // create DataBase. pSplash->showMessage("Initialise the Database...");// shows comments w.databaseobject-> createPlayListTables(); // DB created but need another object in mainwindow!!pSplash->showMessage("load data..."); w.loadProgamListFromDB(); //load data to applicationreturn a.exec();}
public class SplashActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.splash);
Handler handler = new Handler(); handler.postDelayed(new Runnable() {
@Override public void run() { Intent intent = new Intent(SplashActivity.this,MainActivity.class); startActivity(intent); finish(); } }, 3000); }
QApplication a(argc, argv);
a.connect(&a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );// added test for player// The splash screen
QSplashScreen *pSplash = new QSplashScreen();
pSplash->setPixmap(QPixmap(":images/Splash.png"));
pSplash->show();
pSplash->showMessage("Start ...");// main window
MainWindow w;
w.setWindowTitle(QObject::tr(" my title"));
w.hide();// mainwindow disappearsQTimer::singleShot(3000, pSplash, SLOT(close()));// close splash after 4s
QTimer::singleShot(3000, &w, SLOT(slInit()));// mainwindow reappears after 4s
// create DataBase.
pSplash->showMessage("Initialise the Database...");// shows comments
w.databaseobject-> createPlayListTables(); // DB created but need another object in mainwindow!!pSplash->showMessage("load data...");
w.loadProgamListFromDB(); //load data to applicationreturn a.exec();}
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(SplashActivity.this,MainActivity.class);
startActivity(intent);
finish();
}
}, 3000);
}
}这介一种方式,新浪微薄貌似就这样做的。