That does not seem right to me, and I am not an expert on such things.

More reasonable, in my opinion, would be to have a
ContentProviderInitializer Service that is kicked off at the
appropriate time.

In my opinion, ContentProviders are complex enough without adding more
complexity in that code.

But, what do I know?...



On Sep 17, 4:48 am, netlander <[email protected]> wrote:
> Thanks for your prompt answer Brion,
>
> Managed to put the time consuming portion of the code in an AsyncTask
> inside the ContentProvider. It seems to be doing the job, my main
> activity is not hanging.
>
> Now I have two questions which I need to answer:
>
> (1) Is this a correct usage of the API? i.e. is it ok to use an
> AsyncTask inside the ContentProvider?
> (2) Is there a way for my main activity to get notification when the
> ContentProvider has finished initialising?
>
> Input from the Android dev team would be highly appreciated.
>
> Many thanks
>
> On Sep 16, 5:56 pm, Brion Emde <[email protected]> wrote:
>
>
>
> > You should perhaps kick off an IntentService or a Service with an
> > AsyncTask that reads your data files and updates the ContentProvider
> > in the background. Then you could publish your progress via the
> > AsyncTask's methods for doing that.
>
> > On Sep 16, 12:03 pm, netlander <[email protected]> wrote:
>
> > > Hi,
>
> > > My app has one activity and one ContentProvider, the activity is
> > > simple in that it's just a splash screen at the moment with no other
> > > logic in it (I do intend to have more activities in the app). The
> > > ContentProvider uses SQLite as a back end and loads some static data
> > > from files on first install, a slow process due to file sizes and
> > > database initialisation.
>
> > > My problem is that I want the activity to show up as soon as the
> > > install starts and maybe display a progress bar or dialog to show the
> > > user progress about the install. At the moment I get a blank (white)
> > > screen while the ContentProvider is initialising the data which takes
> > > quite a long time and I get "Activity idle timeout for history record"
> > > warning in LogCat. My splash screen only shows when the
> > > ContentProvider is done, from the app standpoint this is undesirable
> > > behaviour.
>
> > > One potential solutions would be to manually start the provider via an
> > > AsyncTask but I have a feeling that this is a bad approach due to the
> > > fact that if the activity is interupted and restarted while the
> > > install is underway and a new AsyncTast is created through the
> > > activity's onCreate() then I'll have worst problems on my hands.
>
> > > Is there a way to start the content provider in the background and
> > > display my splash screen activity straight after the app is started?
> > > Note that this problem is only an issue on first install.
>
> > > Many thanks

-- 
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