ContentProvider InstantiationException

by droozen » Fri, 06 Mar 2009 21:51:50 GMT


Sponsored Links
 So, I was trying to create my own ContentProvider. I want a recurring
notification (say, once a day) so I discovered that I should be able
to do this by setting a repeating alarm that my BroadcastReceiver
class can pick up. Because it's going to perform some calcs, it
immediately starts a service. So far, so good.

My service will need to access some data in the SQLite database in my
application. So I made a content provider to provide that
functionality. However, after making the content provider and adding
the provider to my manifest between the application tags:

<provider android:name="--Fully qualified path name to ContentProvider
class--" android:authorities="--authority to be used--"></provider>

Now my application, when it starts up, immediately fails with a
InstantiationException for my ContentProvider. Any idea what I'm doing
wrong? Or what else I need to be doing right?
--~--~---------~--~----~------------~-------~--~----~



ContentProvider InstantiationException

by Dianne Hackborn » Sat, 07 Mar 2009 02:11:05 GMT


 When a process is started, all content providers that run in it are
instantiated.  Apparently your new content provider can't be instantiated.






-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


ContentProvider InstantiationException

by droozen » Sat, 07 Mar 2009 02:25:18 GMT


 Hence the InstantiationException. I get that. But WHY can't it be
instantiated or, the real kicker, how can I get it to work? From what
I can tell, and from what I keep reading in everything I can find on
ContentProviders, everything looks fine with my setup. I don't even
know where to look to try to fix my setup. Has anyone else ever
encountered this and figured out why your provider couldn't be
instantiated?




--~--~---------~--~----~------------~-------~--~----~



ContentProvider InstantiationException

by Marco Nelissen » Sat, 07 Mar 2009 02:33:28 GMT


 Did you forget to mark your provider class as public?







--~--~---------~--~----~------------~-------~--~----~



ContentProvider InstantiationException

by droozen » Sat, 07 Mar 2009 02:39:52 GMT


 Provider class public. Check: public class SavingsDbAdapter extends
ContentProvider

:) And I implement all the methods for a ContentProvider that Eclipse
asked me to. I do have some static code that runs first, as the
NotesList example does at the bottom of the class. That code seems to
run fine before I hit the exception. I also have added the
android:multiprocess parameter to true, but I wouldn't expect that to
have any effect either way on my problem.






--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. My emluator is occupying 100% CPU, Why?

Hi All,

My emluator is occupying 100% CPU. I am a fresh man and just now
created a HelloWorld in Eclipse. When I ran it "as an Android
application", after a while, it keep 100% occupying some minutes and
only the text "Android_" with black background in the emluator.

My OS is Windows XP and Eclipse is 3.4. I have tried JDK5 and JDK6. I
have tried many times today and yesterday.

Could anyone tell me how to solve it? Thank you.

Here is my console lines in Eclipse:
After I lunch as below,
[2009-08-24 19:37:43 - HelloWorld] ------------------------------
[2009-08-24 19:37:43 - HelloWorld] Android Launch!
[2009-08-24 19:37:43 - HelloWorld] adb is running normally.
[2009-08-24 19:37:43 - HelloWorld] Performing com.test.HelloWorld
activity launch
[2009-08-24 19:37:43 - HelloWorld] Automatic Target Mode: launching
new emulator with compatible AVD 'my_avd'
[2009-08-24 19:37:43 - HelloWorld] Launching a new emulator with
Virtual Device 'my_avd'
[2009-08-24 19:37:52 - HelloWorld] New emulator found: emulator-5554
[2009-08-24 19:37:52 - HelloWorld] Waiting for HOME
('android.process.acore') to be launched...

No way, I kill the emluator, then as below,
[2009-08-24 19:39:24 - Emulator] emulator: emulator window was out of
view and was recentred
[2009-08-24 19:39:24 - Emulator]

--~--~---------~--~----~------------~-------~--~----~

2. Seeking beta testers

Posting this on 'developers' instead of 'discuss' because I strongly
prefer to hit only developers with this "free app" offer.

I have had a very hard time getting any "real" users to volunteer to
be beta testers for my app, despite calls on the app description and
inside the app itself.

...so, if anyone on this list has a need for a basic spread sheet app
and would like to beta test new versions of Shead Spreet for me,
please drop me an email off list.  Don't clutter this thread or the
list any further unless there is something relevant to contribute.

You'll basically get the app for free (well, the beta version anyway,
you would have to purchase it through the Market if you wanted the
subsequent release version I suppose...or maybe I could hook you up;
that's never been an issue in the past since all previous beta testers
were already paid users anyway).

First come, first serve, I'll only accept as many as I feel I need.

Thanks.

Cheers!

--~--~---------~--~----~------------~-------~--~----~

3. Some questions about running HelloWorld?

4. Can an end user disable 2G data, or GSM function?

5. missing module bootsound

6. Lossless rotation of a jpeg image in Android (without fully decoding the image). How to?

7. Icons showing up in the gallery folder