public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
loadData();
setContentView(R.layout.preload);
Thread thread = new Thread()
{
@Override
public void run() {
setUpDB();
setContentView(R.layout.main);
}
};
thread.start();
}
So I want it to show the preload view while the database is setting up (setUpDB) and then switch to the main view when the setup is complete change to the main view. I had it almost working; showing the loader until about 80% and then crashing, but now I can’t even get it to show the loader… if I have setUpDB() in the thread it crashes, if I have it outside the thread it shows a blank screen until fully loaded. I can’t remember the code I had before… any ideas?
Declare a Handler and call it to update your UI like this,