0

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");
}
SverkerSbrg
  • 503
  • 1
  • 9
  • 23
  • What is your activity doing in `onCreate/onResume`? Anything happening on the UI thread can slow up the loading. If you can move stuff to an AsyncTask or Thread, do it. – Geobits Oct 08 '13 at 16:25
  • Almost only building the gui. Addet the code. Should i do things differently? Laid out the structure for this when i was just getting started with android... :S – SverkerSbrg Oct 08 '13 at 16:29
  • Well, if you just want to remove the title bar from the start, try the XML suggestions [here](http://stackoverflow.com/a/2627952/752320). It will still take 1/10 sec to load, but it shouldn't show the title bar. – Geobits Oct 08 '13 at 16:37
  • Well that has simple :) Thank you! – SverkerSbrg Oct 08 '13 at 16:41

0 Answers0