*> My code will run right until it gets to creating the telephony manager
instance but will not actually create it and it throws aNullPointerException
(I think).*
What do you mean "I think"?  Have you looked at the logcat info to determine
what the problem may be?  Look specifically for a "caused by" line...
*
> Is there something I'm doing wrong?*
Yes... otherwise you wouldn't get the exception.  :-)

*> Do I have to create a context and call getSystemService(...) with
context.getSystemService(...)?*
Application is a Context... so you don't need to create a new one.  You
should be able to call this method just fine from an Application subclass.

I've never subclassed Application before so I'm not super qualified on the
subject, but what does your application tag in your manifest look like?  I
ask that because the documentation for the Application class (
http://developer.android.com/reference/android/app/Application.html) says
this:

*"Base class for those who need to maintain global application state. You
can provide your own implementation by specifying its name in your
AndroidManifest.xml's <application> tag, which will cause that class to be
instantiated for you when the process for your application/package is
created."
*
----------------------------------------------------------------------
There are only 10 types of people in the world...
Those who know binary and those who don't.
----------------------------------------------------------------------


On Mon, Aug 2, 2010 at 1:42 PM, Wall-E <bashee...@gmail.com> wrote:

> Oh, and I do add the following permission:
>
> <uses-permission android:name="android.permission.READ_PHONE_STATE" />
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Beginners" group.
>
> NEW! Try asking and tagging your question on Stack Overflow at
> http://stackoverflow.com/questions/tagged/android
>
> To unsubscribe from this group, send email to
> android-beginners+unsubscr...@googlegroups.com<android-beginners%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-beginners?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to