I'm working on a small project and i'm currently trying to fix the small aesthetic things. During the time my GUI is building (on my Galaxy S2 between 60-100ms, measured between start of onCreate and the onResume call) is a blank white activity with the title bar (which i later remove) visible. Is there any good solution to get rid of this little disturbance? I thought of adding a loading screen but it seems kind of silly to just flash one for a tenth of a second.
Can i just keep the screen black? Or white and just keep it from drawing the titlebar.
Or can i maybe get it to flash a picture of the logo at once?
Ideas would be much appreciated :)
OnCreate:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
time = Calendar.getInstance().getTimeInMillis();
General.setAuthernticator(this);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.swipe_menu_layout);
//THIS IS THE "HEAVY" LIFTING
mPager = (ViewPager) findViewById(R.id.pager);
mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
mPager.setAdapter(mPagerAdapter);
mIndicator = (TitlePageIndicator)findViewById(R.id.indicator);
mIndicator.setViewPager(mPager);
mIndicator.setBackgroundColor(this.getResources().getColor(R.color.blue_0));
mIndicator.setFooterColor(this.getResources().getColor(R.color.blue_4));
mIndicator.setTextColor(this.getResources().getColor(R.color.blue_3));
mIndicator.setSelectedColor(this.getResources().getColor(R.color.blue_4));
mIndicator.setOnPageChangeListener(this);
if(!General.getBoolPref(General.VALUE_INSERTED_PREF)){
mIndicator.setCurrentItem(0);
}else{
mIndicator.setCurrentItem(1);
}
PTHandler.addTransactions();
Point outSize = new Point();
Display display = this.getWindowManager().getDefaultDisplay();
try {
// test for new method to trigger exception
Class pointClass = Class.forName("android.graphics.Point");
Method newGetSize = Display.class.getMethod("getSize", new Class[]{ pointClass });
// no exception, so new method is available, just use it
newGetSize.invoke(display, outSize);
}catch(NoSuchMethodException ex) {
// new method is not available, use the old ones
outSize.x = display.getWidth();
outSize.y = display.getHeight();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
outSize.x = 480;
outSize.y = 800;
}
GUI_attrs.setScreenSize(outSize.x, outSize.y);
}
OnResume:
@Override
public void onResume(){
super.onResume();
System.out.print("Draw time: " + (Calendar.getInstance().getTimeInMillis() - time) + ";\n");
}