Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 289
Registered: ‎10-17-2008
My Device: Torch 9800
My Carrier: Rogers
Accepted Solution

splash screen - no user intervention or timer

Hello,

 

I would like to have a splash screen that clears only when my main application screen is ready to be displayed. I do not want to set a timer or have the user hit a key to clear the splash screen. Would anybody have suggested code on how I might accomplish this?

 

Thanks,

 

feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
Developer
Posts: 17,011
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: splash screen - no user intervention or timer

what determines if the main application screen is ready to displayed?
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 289
Registered: ‎10-17-2008
My Device: Torch 9800
My Carrier: Rogers

Re: splash screen - no user intervention or timer

The main thing that seems to be holding up the initial application load is reading from an SQLite database.

 

Thanks,

 

feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
Developer
Posts: 17,011
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: splash screen - no user intervention or timer

you can use a callback to notify the splashscreen that the sql read is finished. or have a reference to the splashscreen in your mainscreen and pop it.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 289
Registered: ‎10-17-2008
My Device: Torch 9800
My Carrier: Rogers

Re: splash screen - no user intervention or timer

Not having any luck yet...

 

So far my code does not display the splash screen. It just goes straight to displaying the main screen. Thoughts?

 

	public Checklist3()
	{		
		VerticalFieldManager manSplash = new VerticalFieldManager(VerticalFieldManager.NO_VERTICAL_SCROLL);
		ScreenSplash screenSplash = new ScreenSplash(manSplash);
		pushScreen(screenSplash);
				
		HomeScreen screenHome = new HomeScreen(); 
		pushScreen(screenHome);
	}

 

feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
Highlighted
Developer
Posts: 246
Registered: ‎12-13-2010
My Device: Not Specified

Re: splash screen - no user intervention or timer

Can you show the complete code listing?

Developer
Posts: 289
Registered: ‎10-17-2008
My Device: Torch 9800
My Carrier: Rogers

Re: splash screen - no user intervention or timer

Here's the code for ScreenSplash:

 

public class ScreenSplash extends MainScreen
{

	public ScreenSplash(Manager manSplash)
	{		
		super();
		
		this.add(manSplash);
		
		LabelField fieldTitle1 = new LabelField("Bashbored", LabelField.FIELD_HCENTER);
		LabelField fieldTitle2 = new LabelField("Tasks", LabelField.FIELD_HCENTER);
				
		manSplash.add(fieldTitle1);
		manSplash.add(fieldTitle2);
	}	
}

 

feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
Developer
Posts: 289
Registered: ‎10-17-2008
My Device: Torch 9800
My Carrier: Rogers

Re: splash screen - no user intervention or timer

Would anyone know why am not getting my expected results with the following code?

 

I would expect screenSplash to be displayed and then when the new screenHome is done processing and ready to go, screenSplash should disappear and screenHome is displayed. However, all that happens is that my app goes straight to displaying screenHome. screenSplash does not get displayed.

 

I know that screenSplash is fine because if I comment out the screenHome lines, screenSplash displays.

 

screenHome is a final class that extends MainScreen. screenSplash simply extends MainScreen. Is that part of the reason why I'm not seeing screenSplash?

 

Thanks,

 

	public Checklist3()
	{					
		ScreenSplash screenSplash = new ScreenSplash();
		pushScreen(screenSplash);
		
		HomeScreen screenHome = new HomeScreen(); 
		popScreen(screenSplash);
		pushScreen(screenHome);
	}

 

feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
Developer
Posts: 246
Registered: ‎12-13-2010
My Device: Not Specified

Re: splash screen - no user intervention or timer

I need to see what's in HomeScreen. I suspect the problem is there.

Developer
Posts: 289
Registered: ‎10-17-2008
My Device: Torch 9800
My Carrier: Rogers

Re: splash screen - no user intervention or timer

[ Edited ]

Here it is. Thanks for looking into it so far.

 

	final class HomeScreen extends MainScreen
{
    final String PREFERENCES_FILENAME = "file:///SDCard/BlackBerry/documents/prefdata.chk";
   
    private int iLastSwipeTime = 0;
    private boolean bStartedCorrectly = false;
   
    public ChecklistDatabase dbChecklist;
    public static Preferences pPreferences = new Preferences();
   
    MetricsThread threadMetrics;
   
    ChecklistField fldListOfChecklists = new ChecklistField(ObjectListField.FOCUSABLE);
   
    public HomeScreen()
    {           
        try
        {
            // read preferences data
            FileConnection fconn = (FileConnection)Connector.open(PREFERENCES_FILENAME);
            if (fconn.exists())
            {
                DataInputStream disRead3 = fconn.openDataInputStream();
                pPreferences.ReadPreferencesFromFile(disRead3);
                disRead3.close();
            }
            else
            {
                // create initial default categories
                Category catNewBusiness = new Category("Business", false);
                Category catNewPersonal = new Category("Personal", false);
                pPreferences.vCategories.addElement(catNewBusiness);
                pPreferences.vCategories.addElement(catNewPersonal);                       
            }
            fconn.close();
           
            dbChecklist = new ChecklistDatabase(); // open database
           
            addMenuItem(new MenuItemCategory("Filter Categories", 40, 40));
            addMenuItem(new MenuItemTemplates("Templates", 41, 41));
            addMenuItem(new MenuItemSaveAsTemplate("Save As Template", 42, 42));       
            addMenuItem(new MenuItemHelp("Help", 43, 43));
           
            add(fldListOfChecklists);
            fldListOfChecklists.Update(0);           
           
            threadMetrics = new MetricsThread(dbChecklist);           
           
            bStartedCorrectly = true;           
        }
        catch (IOException ioe)
        {                       
            UiApplication.getUiApplication().invokeLater(
                    new Runnable()
                    {
                        public void run()
                        {
                            Dialog dialog = new Dialog(Dialog.D_OK, "Error starting Bashbored Tasks. Check SD card is installed.", 0, null, Field.FOCUSABLE);
                            dialog.setDialogClosedListener(new MyDialogClosedListener());
                            dialog.show();                           
                        }
                       
                        final class MyDialogClosedListener implements DialogClosedListener
                        {
                            public MyDialogClosedListener() { }
                           
                            public void dialogClosed(Dialog dialog, int choice)
                            {
                                onClose();
                            }
                        }
                    }
                    );
        }       
    }

 

feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.