[android-developers] splash image when app is loading

2011-02-11 Thread DanielleM
Hello all:

I was wondering if there is a way to have a splash image display while
my app is loading? As it is right now, it's just a black screen until
the main activity launches and it may confuse people into thinking
that the app is stuck or not launching properly.

Thanks,
DM

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] splash image when app is loading

2011-02-11 Thread Marcin Orlowski
On 11 February 2011 18:11, DanielleM dmurkerso...@gmail.com wrote:
 Hello all:

 I was wondering if there is a way to have a splash image display while
 my app is loading? As it is right now, it's just a black screen until
 the main activity launches and it may confuse people into thinking
 that the app is stuck or not launching properly.

No, you can't have any splash screen while app is loading. If your
app needs some time to start up *after* being loaded by OS, then
you may show up something (splash image, progress bar etc)
to notice users you're loaded and yet busy working...

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] splash image when app is loading

2011-02-11 Thread Danielle Murkerson
Ok...so I would need to use some kind of listener for the between time of
the app loading and starting? I mean I see this all the time on other apps
so I was just wondering how they do this?

Usually you click the launcher icon and then an image is displayed for a
short time and then the app starts. I assumed the image is used as a
placeholder while the app finishes loading.

Thanks,
DM

On Fri, Feb 11, 2011 at 1:01 PM, Marcin Orlowski
webnet.andr...@gmail.comwrote:

 On 11 February 2011 18:11, DanielleM dmurkerso...@gmail.com wrote:
  Hello all:
 
  I was wondering if there is a way to have a splash image display while
  my app is loading? As it is right now, it's just a black screen until
  the main activity launches and it may confuse people into thinking
  that the app is stuck or not launching properly.

 No, you can't have any splash screen while app is loading. If your
 app needs some time to start up *after* being loaded by OS, then
 you may show up something (splash image, progress bar etc)
 to notice users you're loaded and yet busy working...

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] splash image when app is loading

2011-02-11 Thread Justin Giles
There's several approaches for doing this.  Just Google android splash
screen.  I think one of the first few links contains info that I used to
create my own.

On Fri, Feb 11, 2011 at 12:53 PM, Danielle Murkerson dmurkerso...@gmail.com
 wrote:

 Ok...so I would need to use some kind of listener for the between time of
 the app loading and starting? I mean I see this all the time on other apps
 so I was just wondering how they do this?

 Usually you click the launcher icon and then an image is displayed for a
 short time and then the app starts. I assumed the image is used as a
 placeholder while the app finishes loading.

 Thanks,
 DM


 On Fri, Feb 11, 2011 at 1:01 PM, Marcin Orlowski webnet.andr...@gmail.com
  wrote:

 On 11 February 2011 18:11, DanielleM dmurkerso...@gmail.com wrote:
  Hello all:
 
  I was wondering if there is a way to have a splash image display while
  my app is loading? As it is right now, it's just a black screen until
  the main activity launches and it may confuse people into thinking
  that the app is stuck or not launching properly.

 No, you can't have any splash screen while app is loading. If your
 app needs some time to start up *after* being loaded by OS, then
 you may show up something (splash image, progress bar etc)
 to notice users you're loaded and yet busy working...

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] splash image when app is loading

2011-02-11 Thread Kostya Vasilyev

11.02.2011 21:53, Danielle Murkerson пишет:
Ok...so I would need to use some kind of listener for the between time 
of the app loading and starting? I mean I see this all the time on 
other apps so I was just wondering how they do this?


The distinction, if any, between loading and starting, is entirely in 
your code.


Android brings your process into memory, creates the main activity, and 
starts calling its lifecycle methods: onCreate, onStart, onResume, and 
off you go.


If you have a lengthly operation (to load textures in a game, unpack 
compressed RSS stream, etc.), then you can:


1. have your main activity set its content to a splash image;
2. schedule lengthy operations on a background thread, AsyncTask (or any 
other way that doesn't tie up the UI);
3. handshake back to the main activity when those lengthy operations are 
completed, and present the UI for interacting with your application.


Item 2 is a good idea anyway, because if you run a lengthy operation in 
one of the above lifecycle callbacks (onCreate, etc.), and it exceeds 
the time limit allowed by Android, then the user will see the ANR popup 
(Application Not Responding - giving the user a choice to kill it or to 
give it more time).




Usually you click the launcher icon and then an image is displayed for 
a short time and then the app starts. I assumed the image is used as a 
placeholder while the app finishes loading.


I believe Android just animates a mock-up of the activity, based on what 
it can gather from the manifest (the color scheme and the title). This 
happens before onCreate.


--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] splash image when app is loading

2011-02-11 Thread Danielle Murkerson
Yes this may be the way to go for me. My main activity has to setup and
prepare a couple of MediaPlayer objects to play some streaming audio...this
may take a while on a slow connection and I've seen some examples that use
the onPostExecute method of an AsyncTask to tell the activity when to stop
displaying the splash image.

Thanks for the tips...I'll look into this more.

On Fri, Feb 11, 2011 at 2:10 PM, Kostya Vasilyev kmans...@gmail.com wrote:

 11.02.2011 21:53, Danielle Murkerson пишет:

  Ok...so I would need to use some kind of listener for the between time of
 the app loading and starting? I mean I see this all the time on other apps
 so I was just wondering how they do this?


 The distinction, if any, between loading and starting, is entirely in your
 code.

 Android brings your process into memory, creates the main activity, and
 starts calling its lifecycle methods: onCreate, onStart, onResume, and off
 you go.

 If you have a lengthly operation (to load textures in a game, unpack
 compressed RSS stream, etc.), then you can:

 1. have your main activity set its content to a splash image;
 2. schedule lengthy operations on a background thread, AsyncTask (or any
 other way that doesn't tie up the UI);
 3. handshake back to the main activity when those lengthy operations are
 completed, and present the UI for interacting with your application.

 Item 2 is a good idea anyway, because if you run a lengthy operation in one
 of the above lifecycle callbacks (onCreate, etc.), and it exceeds the time
 limit allowed by Android, then the user will see the ANR popup (Application
 Not Responding - giving the user a choice to kill it or to give it more
 time).



 Usually you click the launcher icon and then an image is displayed for a
 short time and then the app starts. I assumed the image is used as a
 placeholder while the app finishes loading.


 I believe Android just animates a mock-up of the activity, based on what it
 can gather from the manifest (the color scheme and the title). This happens
 before onCreate.

 --
 Kostya Vasilyev -- WiFi Manager + pretty widget --
 http://kmansoft.wordpress.com

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] splash image when app is loading

2011-02-11 Thread Kevin Duffey
I was going to suggest something similar to what Kostya suggested. As he
said, if you're taking time to load things in an onCreate, first you want to
move it to a thread (AsyncTask). What I do is I've found one of the examples
out there that sets my launcher to the SplashScreenActivity. In my case, I
do it just for showing info about the app, author, etc. So I have a timer
counting down for 15 seconds (which is way too long). If the user touches
the screen at any point, it then times out immediately. Either way, it
starts my main activity at that point. As Kostya said, in your case, once
your background loading stuff is done, start the main activity. This way
they see your splash screen until all the loading is done. You can even make
an animated splash screen to help alleviate the amount of time it seems a
person is waiting.


On Fri, Feb 11, 2011 at 11:31 AM, Danielle Murkerson dmurkerso...@gmail.com
 wrote:

 Yes this may be the way to go for me. My main activity has to setup and
 prepare a couple of MediaPlayer objects to play some streaming audio...this
 may take a while on a slow connection and I've seen some examples that use
 the onPostExecute method of an AsyncTask to tell the activity when to stop
 displaying the splash image.

 Thanks for the tips...I'll look into this more.


 On Fri, Feb 11, 2011 at 2:10 PM, Kostya Vasilyev kmans...@gmail.comwrote:

 11.02.2011 21:53, Danielle Murkerson пишет:

  Ok...so I would need to use some kind of listener for the between time of
 the app loading and starting? I mean I see this all the time on other apps
 so I was just wondering how they do this?


 The distinction, if any, between loading and starting, is entirely in your
 code.

 Android brings your process into memory, creates the main activity, and
 starts calling its lifecycle methods: onCreate, onStart, onResume, and off
 you go.

 If you have a lengthly operation (to load textures in a game, unpack
 compressed RSS stream, etc.), then you can:

 1. have your main activity set its content to a splash image;
 2. schedule lengthy operations on a background thread, AsyncTask (or any
 other way that doesn't tie up the UI);
 3. handshake back to the main activity when those lengthy operations are
 completed, and present the UI for interacting with your application.

 Item 2 is a good idea anyway, because if you run a lengthy operation in
 one of the above lifecycle callbacks (onCreate, etc.), and it exceeds the
 time limit allowed by Android, then the user will see the ANR popup
 (Application Not Responding - giving the user a choice to kill it or to give
 it more time).



 Usually you click the launcher icon and then an image is displayed for a
 short time and then the app starts. I assumed the image is used as a
 placeholder while the app finishes loading.


 I believe Android just animates a mock-up of the activity, based on what
 it can gather from the manifest (the color scheme and the title). This
 happens before onCreate.

 --
 Kostya Vasilyev -- WiFi Manager + pretty widget --
 http://kmansoft.wordpress.com

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] splash image when app is loading

2011-02-11 Thread Danielle Murkerson
Yes this makes sense...I have a question regarding how my app is set up
though...I'm using a tabbed interface where each tab launches a new
activity. So basically the activity that would launch first sets up the tabs
and then starts the activity that is in the first tab...So would I put my
splash screen code in the activity that sets up the tabs, or put it in the
activity that the user actually sees once the tabs are done setting up?

I'm new to android programming and I've basically built my app from seeing
examples of similar things that I want to accomplish in my app. This came
about because I got the app running perfectly in the emulator...but when I
tested it on two different real devices, it wouldn't load at all on one and
it seemed to work ok on the other.

It seemed to install correctly on the device that it wouldn't load on, it
just never got past the black screen before the first activity starts. And
then it would take forever to even try and go back to the device's home
screen. So I'm trying to go back and look at my code and see if there is
something I could re-work to make it more efficient or something.

On Fri, Feb 11, 2011 at 3:06 PM, Kevin Duffey andjar...@gmail.com wrote:

 I was going to suggest something similar to what Kostya suggested. As he
 said, if you're taking time to load things in an onCreate, first you want to
 move it to a thread (AsyncTask). What I do is I've found one of the examples
 out there that sets my launcher to the SplashScreenActivity. In my case, I
 do it just for showing info about the app, author, etc. So I have a timer
 counting down for 15 seconds (which is way too long). If the user touches
 the screen at any point, it then times out immediately. Either way, it
 starts my main activity at that point. As Kostya said, in your case, once
 your background loading stuff is done, start the main activity. This way
 they see your splash screen until all the loading is done. You can even make
 an animated splash screen to help alleviate the amount of time it seems a
 person is waiting.


 On Fri, Feb 11, 2011 at 11:31 AM, Danielle Murkerson 
 dmurkerso...@gmail.com wrote:

 Yes this may be the way to go for me. My main activity has to setup and
 prepare a couple of MediaPlayer objects to play some streaming audio...this
 may take a while on a slow connection and I've seen some examples that use
 the onPostExecute method of an AsyncTask to tell the activity when to stop
 displaying the splash image.

 Thanks for the tips...I'll look into this more.


 On Fri, Feb 11, 2011 at 2:10 PM, Kostya Vasilyev kmans...@gmail.comwrote:

 11.02.2011 21:53, Danielle Murkerson пишет:

  Ok...so I would need to use some kind of listener for the between time
 of the app loading and starting? I mean I see this all the time on other
 apps so I was just wondering how they do this?


 The distinction, if any, between loading and starting, is entirely in
 your code.

 Android brings your process into memory, creates the main activity, and
 starts calling its lifecycle methods: onCreate, onStart, onResume, and off
 you go.

 If you have a lengthly operation (to load textures in a game, unpack
 compressed RSS stream, etc.), then you can:

 1. have your main activity set its content to a splash image;
 2. schedule lengthy operations on a background thread, AsyncTask (or any
 other way that doesn't tie up the UI);
 3. handshake back to the main activity when those lengthy operations are
 completed, and present the UI for interacting with your application.

 Item 2 is a good idea anyway, because if you run a lengthy operation in
 one of the above lifecycle callbacks (onCreate, etc.), and it exceeds the
 time limit allowed by Android, then the user will see the ANR popup
 (Application Not Responding - giving the user a choice to kill it or to give
 it more time).



 Usually you click the launcher icon and then an image is displayed for a
 short time and then the app starts. I assumed the image is used as a
 placeholder while the app finishes loading.


 I believe Android just animates a mock-up of the activity, based on what
 it can gather from the manifest (the color scheme and the title). This
 happens before onCreate.

 --
 Kostya Vasilyev -- WiFi Manager + pretty widget --
 http://kmansoft.wordpress.com

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 

Re: [android-developers] splash image when app is loading

2011-02-11 Thread Kostya Vasilyev

11.02.2011 23:13, Danielle Murkerson пишет:
It seemed to install correctly on the device that it wouldn't load on, 
it just never got past the black screen before the first activity 
starts. And then it would take forever to even try and go back to the 
device's home screen.


This seems like an infinite loop somewhere.

Since you don't have access to the device, I would recommend you follow 
the advice given by TreKing: ask the user to install one of the many 
logcat - collecting applications from Market and send you the logs. To 
make this more useful, inspect your code and add frequent logging 
statements, especially around and in places that process data.


--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] splash image when app is loading

2011-02-11 Thread Kevin Duffey
First, are you using debug mode with your physical device plugged in to the
USB slot and deploying that way? It will allow you to watch the LogCat
output, you can put Log.i() info throughout your code to try to trace it or
use the debugger and break points, whichever your fancy. You may see why one
device is taking a long time and the other isnt.

As for the tabs and what to do.. I would create a completely new Activity,
called SplashActivity or whatever. Separate layout xml for it. Put that as
your starting launcher. From there, you would launch your activity that sets
up the tabs. I haven't done anything with tabs yet.. is ti required that
each tab be a separate activity.. is that the normal way it works (anyone)?
I would have thought you could use a single activity and listen for tab
changes and set the content view to a new view for that tab, rather than
separate activities for each. If you can do that, then you load all your
data during the splash screen, then start the tab activity and you are good
to go. If it is pretty common or the only way to do tabs is with separate
activities, then generally I take the lazy approach. A user may never select
any other tab, so why load the data for it up front? That takes up
resources. If you have too much data, you could degrade the device
performance, and cause android to shut down other running applications
(er..running but in pause mode of course). If each tab requires a couple
seconds or so to load data, maybe in the tab switching handler, put up a
simple alert box with a spinning meter to show something is happening. I'd
also look at releasing the previously selected tabs data. From what I've
learned, even with 256MB up to 1GB or more ram, you are still very limited
in memory because of the potential of other apps running (again, in pause
mode while your app is up on top) and consuming resources. You want to try
to play nice with the overall idea of multiple apps running as much as
possible. Don't forget to release all your resources in the onPause handler
for each activity, and handle those events properly.


On Fri, Feb 11, 2011 at 12:13 PM, Danielle Murkerson dmurkerso...@gmail.com
 wrote:

 Yes this makes sense...I have a question regarding how my app is set up
 though...I'm using a tabbed interface where each tab launches a new
 activity. So basically the activity that would launch first sets up the tabs
 and then starts the activity that is in the first tab...So would I put my
 splash screen code in the activity that sets up the tabs, or put it in the
 activity that the user actually sees once the tabs are done setting up?

 I'm new to android programming and I've basically built my app from seeing
 examples of similar things that I want to accomplish in my app. This came
 about because I got the app running perfectly in the emulator...but when I
 tested it on two different real devices, it wouldn't load at all on one and
 it seemed to work ok on the other.

 It seemed to install correctly on the device that it wouldn't load on, it
 just never got past the black screen before the first activity starts. And
 then it would take forever to even try and go back to the device's home
 screen. So I'm trying to go back and look at my code and see if there is
 something I could re-work to make it more efficient or something.


 On Fri, Feb 11, 2011 at 3:06 PM, Kevin Duffey andjar...@gmail.com wrote:

 I was going to suggest something similar to what Kostya suggested. As he
 said, if you're taking time to load things in an onCreate, first you want to
 move it to a thread (AsyncTask). What I do is I've found one of the examples
 out there that sets my launcher to the SplashScreenActivity. In my case, I
 do it just for showing info about the app, author, etc. So I have a timer
 counting down for 15 seconds (which is way too long). If the user touches
 the screen at any point, it then times out immediately. Either way, it
 starts my main activity at that point. As Kostya said, in your case, once
 your background loading stuff is done, start the main activity. This way
 they see your splash screen until all the loading is done. You can even make
 an animated splash screen to help alleviate the amount of time it seems a
 person is waiting.


 On Fri, Feb 11, 2011 at 11:31 AM, Danielle Murkerson 
 dmurkerso...@gmail.com wrote:

 Yes this may be the way to go for me. My main activity has to setup and
 prepare a couple of MediaPlayer objects to play some streaming audio...this
 may take a while on a slow connection and I've seen some examples that use
 the onPostExecute method of an AsyncTask to tell the activity when to stop
 displaying the splash image.

 Thanks for the tips...I'll look into this more.


 On Fri, Feb 11, 2011 at 2:10 PM, Kostya Vasilyev kmans...@gmail.comwrote:

 11.02.2011 21:53, Danielle Murkerson пишет:

  Ok...so I would need to use some kind of listener for the between time
 of the app loading and starting? I mean I see this all the time on 

Re: [android-developers] splash image when app is loading

2011-02-11 Thread Danielle Murkerson
yes someone else suggested an endless loop as well...but I haven't written
any loops in my code at all. I am definitely planning on taking TreKing's
advice about that...as soon as I can get with my tester we'll work it
out...In the mean time I am going back to the code to see if I can make it
more efficient.

Part of my app has to access some RSS feeds from the website for my company
and we've been having server issues so I know that was causing problems. Our
streaming servers are separate so the device that was actually running the
app had no problems accessing the streams but could not access the feeds due
to the above mentioned issues with the website.

On Fri, Feb 11, 2011 at 4:06 PM, Kostya Vasilyev kmans...@gmail.com wrote:

 11.02.2011 23:13, Danielle Murkerson пишет:

  It seemed to install correctly on the device that it wouldn't load on, it
 just never got past the black screen before the first activity starts. And
 then it would take forever to even try and go back to the device's home
 screen.


 This seems like an infinite loop somewhere.

 Since you don't have access to the device, I would recommend you follow the
 advice given by TreKing: ask the user to install one of the many logcat -
 collecting applications from Market and send you the logs. To make this more
 useful, inspect your code and add frequent logging statements, especially
 around and in places that process data.


 --
 Kostya Vasilyev -- WiFi Manager + pretty widget --
 http://kmansoft.wordpress.com

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] splash image when app is loading

2011-02-11 Thread Kostya Vasilyev

12.02.2011 0:13, Danielle Murkerson пишет:



Part of my app has to access some RSS feeds from the website for my 
company and we've been having server issues so I know that was causing 
problems. Our streaming servers are separate so the device that was 
actually running the app had no problems accessing the streams but 
could not access the feeds due to the above mentioned issues with the 
website.


Are you loading the RSS feeds in the main application thread (same one 
where onCreate, etc) are called?


If so, that would explain the black screen and all.

This is an introduction on why this should not be done and how to change it:

http://developer.android.com/guide/appendix/faq/commontasks.html#threading

--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] splash image when app is loading

2011-02-11 Thread Danielle Murkerson
Yes you can use one activity and just switch views for tabs...but it was
suggested on the Android Developer site to use separate activities for each
tab if each tab is doing a completely different task...Which mine
is...Basically my app has 5 tabs...The first allows a user to listen to our
live streams (I work for public broadcasting), the second allows a user to
listen/view our podcasts, the third allows a user to set an alarm that will
play one of the streams when it activates (don't ask they had to have this
bell and whistle), the fourth allows a user to access our news, and the last
tab allows a user to choose one of our social media sites to visitIt's a
very complicated app that already has an iPhone counter part (that I did not
create). So you can see it's very possible that the app is just not very
efficient.

On Fri, Feb 11, 2011 at 4:07 PM, Kevin Duffey andjar...@gmail.com wrote:

 First, are you using debug mode with your physical device plugged in to the
 USB slot and deploying that way? It will allow you to watch the LogCat
 output, you can put Log.i() info throughout your code to try to trace it or
 use the debugger and break points, whichever your fancy. You may see why one
 device is taking a long time and the other isnt.

 As for the tabs and what to do.. I would create a completely new Activity,
 called SplashActivity or whatever. Separate layout xml for it. Put that as
 your starting launcher. From there, you would launch your activity that sets
 up the tabs. I haven't done anything with tabs yet.. is ti required that
 each tab be a separate activity.. is that the normal way it works (anyone)?
 I would have thought you could use a single activity and listen for tab
 changes and set the content view to a new view for that tab, rather than
 separate activities for each. If you can do that, then you load all your
 data during the splash screen, then start the tab activity and you are good
 to go. If it is pretty common or the only way to do tabs is with separate
 activities, then generally I take the lazy approach. A user may never select
 any other tab, so why load the data for it up front? That takes up
 resources. If you have too much data, you could degrade the device
 performance, and cause android to shut down other running applications
 (er..running but in pause mode of course). If each tab requires a couple
 seconds or so to load data, maybe in the tab switching handler, put up a
 simple alert box with a spinning meter to show something is happening. I'd
 also look at releasing the previously selected tabs data. From what I've
 learned, even with 256MB up to 1GB or more ram, you are still very limited
 in memory because of the potential of other apps running (again, in pause
 mode while your app is up on top) and consuming resources. You want to try
 to play nice with the overall idea of multiple apps running as much as
 possible. Don't forget to release all your resources in the onPause handler
 for each activity, and handle those events properly.



 On Fri, Feb 11, 2011 at 12:13 PM, Danielle Murkerson 
 dmurkerso...@gmail.com wrote:

 Yes this makes sense...I have a question regarding how my app is set up
 though...I'm using a tabbed interface where each tab launches a new
 activity. So basically the activity that would launch first sets up the tabs
 and then starts the activity that is in the first tab...So would I put my
 splash screen code in the activity that sets up the tabs, or put it in the
 activity that the user actually sees once the tabs are done setting up?

 I'm new to android programming and I've basically built my app from seeing
 examples of similar things that I want to accomplish in my app. This came
 about because I got the app running perfectly in the emulator...but when I
 tested it on two different real devices, it wouldn't load at all on one and
 it seemed to work ok on the other.

 It seemed to install correctly on the device that it wouldn't load on, it
 just never got past the black screen before the first activity starts. And
 then it would take forever to even try and go back to the device's home
 screen. So I'm trying to go back and look at my code and see if there is
 something I could re-work to make it more efficient or something.


 On Fri, Feb 11, 2011 at 3:06 PM, Kevin Duffey andjar...@gmail.comwrote:

 I was going to suggest something similar to what Kostya suggested. As he
 said, if you're taking time to load things in an onCreate, first you want to
 move it to a thread (AsyncTask). What I do is I've found one of the examples
 out there that sets my launcher to the SplashScreenActivity. In my case, I
 do it just for showing info about the app, author, etc. So I have a timer
 counting down for 15 seconds (which is way too long). If the user touches
 the screen at any point, it then times out immediately. Either way, it
 starts my main activity at that point. As Kostya said, in your case, once
 your background loading stuff is done, start 

Re: [android-developers] splash image when app is loading

2011-02-11 Thread Kostya Vasilyev

12.02.2011 0:13, Danielle Murkerson пишет:



Part of my app has to access some RSS feeds from the website for my 
company and we've been having server issues so I know that was causing 
problems. Our streaming servers are separate so the device that was 
actually running the app had no problems accessing the streams but 
could not access the feeds due to the above mentioned issues with the 
website.


One more useful link on threading:

http://developer.android.com/resources/articles/painless-threading.html

--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] splash image when app is loading

2011-02-11 Thread Danielle Murkerson
Yes and nothe main application that is the first to launch only displays
buttons to listen to one of our streams...the second tab starts the
Podcast activity where the user can click a button that displays one of 5
different podcastswhich starts a child activity that actually parses and
displays the xml files. Hope that makes sense.

On Fri, Feb 11, 2011 at 4:19 PM, Danielle Murkerson
dmurkerso...@gmail.comwrote:

 Yes you can use one activity and just switch views for tabs...but it was
 suggested on the Android Developer site to use separate activities for each
 tab if each tab is doing a completely different task...Which mine
 is...Basically my app has 5 tabs...The first allows a user to listen to our
 live streams (I work for public broadcasting), the second allows a user to
 listen/view our podcasts, the third allows a user to set an alarm that will
 play one of the streams when it activates (don't ask they had to have this
 bell and whistle), the fourth allows a user to access our news, and the last
 tab allows a user to choose one of our social media sites to visitIt's a
 very complicated app that already has an iPhone counter part (that I did not
 create). So you can see it's very possible that the app is just not very
 efficient.


 On Fri, Feb 11, 2011 at 4:07 PM, Kevin Duffey andjar...@gmail.com wrote:

 First, are you using debug mode with your physical device plugged in to
 the USB slot and deploying that way? It will allow you to watch the LogCat
 output, you can put Log.i() info throughout your code to try to trace it or
 use the debugger and break points, whichever your fancy. You may see why one
 device is taking a long time and the other isnt.

 As for the tabs and what to do.. I would create a completely new Activity,
 called SplashActivity or whatever. Separate layout xml for it. Put that as
 your starting launcher. From there, you would launch your activity that sets
 up the tabs. I haven't done anything with tabs yet.. is ti required that
 each tab be a separate activity.. is that the normal way it works (anyone)?
 I would have thought you could use a single activity and listen for tab
 changes and set the content view to a new view for that tab, rather than
 separate activities for each. If you can do that, then you load all your
 data during the splash screen, then start the tab activity and you are good
 to go. If it is pretty common or the only way to do tabs is with separate
 activities, then generally I take the lazy approach. A user may never select
 any other tab, so why load the data for it up front? That takes up
 resources. If you have too much data, you could degrade the device
 performance, and cause android to shut down other running applications
 (er..running but in pause mode of course). If each tab requires a couple
 seconds or so to load data, maybe in the tab switching handler, put up a
 simple alert box with a spinning meter to show something is happening. I'd
 also look at releasing the previously selected tabs data. From what I've
 learned, even with 256MB up to 1GB or more ram, you are still very limited
 in memory because of the potential of other apps running (again, in pause
 mode while your app is up on top) and consuming resources. You want to try
 to play nice with the overall idea of multiple apps running as much as
 possible. Don't forget to release all your resources in the onPause handler
 for each activity, and handle those events properly.



 On Fri, Feb 11, 2011 at 12:13 PM, Danielle Murkerson 
 dmurkerso...@gmail.com wrote:

 Yes this makes sense...I have a question regarding how my app is set up
 though...I'm using a tabbed interface where each tab launches a new
 activity. So basically the activity that would launch first sets up the tabs
 and then starts the activity that is in the first tab...So would I put my
 splash screen code in the activity that sets up the tabs, or put it in the
 activity that the user actually sees once the tabs are done setting up?

 I'm new to android programming and I've basically built my app from
 seeing examples of similar things that I want to accomplish in my app. This
 came about because I got the app running perfectly in the emulator...but
 when I tested it on two different real devices, it wouldn't load at all on
 one and it seemed to work ok on the other.

 It seemed to install correctly on the device that it wouldn't load on, it
 just never got past the black screen before the first activity starts. And
 then it would take forever to even try and go back to the device's home
 screen. So I'm trying to go back and look at my code and see if there is
 something I could re-work to make it more efficient or something.


 On Fri, Feb 11, 2011 at 3:06 PM, Kevin Duffey andjar...@gmail.comwrote:

 I was going to suggest something similar to what Kostya suggested. As he
 said, if you're taking time to load things in an onCreate, first you want 
 to
 move it to a thread (AsyncTask). What I do is I've found