pIn my application i have a startup page which is a splash. As soon as this activity is started i am setting the content to this page. Then i am doing all the initial updates like DB sync. On completion of those i start next actvity.
SO i deally my applictaion should start showing the splash page and after few secs it should display next page.
What i am getting is when i start the application, there is this blank black page for few secs and then directly second activity page is displayed. If i comment out starting next activity, i can see the black page for few seconds and then the splash page comes and stays
here is my layout and code
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView android:layout_width="fill_parent" android:src="@drawable/defaultimage"
android:layout_height="fill_parent"
android:scaleType="fitXY"
></ImageView>
</LinearLayout
>
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Utils.setStartActivityinstance(this);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.firstpage);
Log.i(TAG, "display set");
Utils.imageLoader = new ImageLoader(this.getApplicationContext());
initialise();
doDataSync();
displayHome();
}
setContentView is called before the initialisations but the display is not getting updated.
This is because you are sync DB and therefore you are getting a blank screen and until your DB gets sync the time period for the Splash Screen get completed and it directly moves to the next Activity. So try to remove the sync DB code and try you will get the exact output. Then for sync DB you must use a background thread that doesn’t not effect the UI-Thread.
eg:- AsyncTask