First, thanks.
I tried blocking the main thread, and quickly determined it wasn't
a good idea.  Didn't solve anything, but hey at least I know now.

Here's what I'm working on:
I have an application.
It downloads a bunch of data and then loads that data into variables
which
are used to present the user with an initial display.

If I load the variables and show the display the screen just goes
black for like
20-30 seconds.

If I background the thread, the variables aren't loaded prior to the
display being drawn.

Ideally, I'd like to use the progressbar  to show a loading screen,
but the loading bar
doesn't show up unless the primary view is ready.

I'm think the solution is to have the program start an initial
activity that is small and prompts
the user for a button press. That button press then activates a thread/
progress bar which
in turn uses an intent to open the "primary" view.

Make sense?

If I have two separate activity files working in the same project, can
I create public variables that are shared?

Thanks,
Josh Beck



On Nov 6, 1:44 pm, Guillaume Perrot <[EMAIL PROTECTED]> wrote:
> You should not use the following in your case but there is a simple
> way to wait for a thread to complete, it's the Thread.join() function.
> This should be called only in a background thread which need to
> synchronize with another background thread for some reason.
> You should (i'd say must) never call blocking functions in the main
> thread.
>
> On Nov 6, 8:53 am, hackbod <[EMAIL PROTECTED]> wrote:
>
> >http://code.google.com/android/intro/appmodel.html
>
> > The last section is on threads, though it's strongly recommended you
> > read the whole thing.
>
> > On Nov 5, 9:58 pm, joshbeck <[EMAIL PROTECTED]> wrote:
>
> > > I'm fairly new at this and just to the point where threading makes
> > > sense.
> > > So, my my main process is also considered a thread?
>
> > > True --- False
>
> > > I write a simple HelloWorld.java program.
> > > This program has 1 thread, the main flow of execution.
>
> > > ?
>
> > > Thanks,
> > > Josh
>
> > > On Nov 5, 7:26 pm, hackbod <[EMAIL PROTECTED]> wrote:
>
> > > > If the thread takes a while to complete, your main application thread
> > > > probably shouldn't wait for it to complete...  otherwise, what's the
> > > > point of putting that work in the thread, if you're just going to
> > > > block on it at some point.
>
> > > > Instead, consider using a Handler to post a message back to the main
> > > > thread when the background thread has finished its work.
>
> > > > On Nov 5, 3:54 pm, joshbeck <[EMAIL PROTECTED]> wrote:
>
> > > > > I have a function that utilizes a thread.
>
> > > > > A variable the is needed for the program is populated after the thread
> > > > > call is made.
>
> > > > > The thread takes a while to complete.
>
> > > > > How can I make the program wait for a thread to complete before moving
> > > > > on?
>
> > > > > Thanks,
> > > > > Josh Beck
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to