How to replace black screen when launching app w/ image

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
sms5138
Posts: 126
Joined: Mon Feb 23, 2015 11:49 pm

How to replace black screen when launching app w/ image

Post by sms5138 » Wed Jun 03, 2015 3:10 pm

Hi everyone!

I've been testing my app on the iphone, and android for a few days now, and wondered if anyone has any suggestions one how show an image or loading bar or really anything when launching the app. The app connects to a database on openstack, and a few things on preopenstack. This can take in some cases 8 to 10 seconds. while it's doing this there is nothing visible on the screen. its just black. is there a way to show an image or anything while it's running through these steps?

Thanks in advance for any advice you may have!

-Sean

atout66
Posts: 266
Joined: Wed Feb 02, 2011 12:31 pm

Re: How to replace black screen when launching app w/ image

Post by atout66 » Wed Jun 03, 2015 3:24 pm

Just an idea...
Couldn't you create a card in the main stack which would be the first card where you would show a Welcome message and just after, send the initAll handler you require with a "Please wait while loading..." text ?
You could replace that text by an image I guess...

Regards, Jean-Paul.
Discovering LiveCode Community 6.5.2.

sms5138
Posts: 126
Joined: Mon Feb 23, 2015 11:49 pm

Re: How to replace black screen when launching app w/ image

Post by sms5138 » Wed Jun 03, 2015 4:18 pm

I'll have to give that a try, and report back.

This thought may be spot on or completely off, but i notice that in the standalone build setting there's an option to upload a "splash screen". Does anyone have experience or knowledge of how a splash screen works or what it's purpose is?

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7403
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: How to replace black screen when launching app w/ image

Post by jacque » Wed Jun 03, 2015 7:28 pm

The splash screen on iOS is intended to get around exactly the problem you're having. It is displayed before your app even begins to load, and gives the user something to look at while all the heavy work is happening. You don't have any control over it, it's just an image and the OS handles the display, so you can't put a progress bar there or anything like that. Apple has guidelines about it, it should look like the first card of your stack but without any data; they give the example of the contacts app which shows the layout without any actual contact data. The data shows up soon after the "empty" form appears.

Android has a place for a splash screen too but I've never used it. I've seen comments here though that it doesn't always work. I'd try it and see. If it doesn't do what you want you should rewrite your app a little bit.

Changing the order of how your app gets its data will solve the problem on both iOS and Android, and is pretty simple. Don't load any data until after the app starts up. The user will see the first card almost immediately, and you have full control over what happens. Instead of getting the data on preOpenStack or preOpenCard, put a command in the openCard handler on the first card that calls the data retrieval using the "in <time>" structure:

Code: Select all

on openCard
 send "getData" to me in 1 millisecond -- adjust if that's too soon
end openCard

on getData
  -- retrieval here
end getData
Another advantage with this method is that you can put up a "loading" message or a progress bar, or some other way of letting the user know that the app is busy.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

sms5138
Posts: 126
Joined: Mon Feb 23, 2015 11:49 pm

Re: How to replace black screen when launching app w/ image

Post by sms5138 » Wed Jun 03, 2015 8:27 pm

Thanks jacque,

I appreciate your help. I'll follow up later after I've had a chance to try it out.

-Sean

Post Reply