[android-beginners] Re: NullPointerException when trying to create TelephonyManager
Look specifically for a caused by line... Yes, in the caused by line is where I'm seeing the NullPointerException (don't worry I'm not making educated guesses). My subclassing of the Application class works, or at least it did before I added the instantiation of the TelophonyManager so I'm pretty sure there is nothing wrong in the Manifest file. The debugger was throwing some java async thread exception so I'm thinking something went haywire with eclipse but I need to do some more research as to what this error means and from what I've researched so far this is whats making it throw the nullpointerexception. The error: Exception processing async thread queue On Aug 2, 5:33 pm, Justin Anderson janderson@gmail.com wrote: * 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.comandroid-beginners%2Bunsubscr i...@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. ATTENTION: Android-Beginners will be permanently disabled on August 9 2010. For more information about this change, please read [http://goo.gl/xkfl] or visit the Group home page. 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
[android-beginners] Re: NullPointerException when trying to create TelephonyManager
Did some more searching and I found out that I am not getting the java async thread exception anymore but I'm still getting the NullPointerException. Anybody else know what I'm doing wrong? On Aug 3, 7:32 am, Wall-E bashee...@gmail.com wrote: Look specifically for a caused by line... Yes, in the caused by line is where I'm seeing the NullPointerException (don't worry I'm not making educated guesses). My subclassing of the Application class works, or at least it did before I added the instantiation of the TelophonyManager so I'm pretty sure there is nothing wrong in the Manifest file. The debugger was throwing some java async thread exception so I'm thinking something went haywire with eclipse but I need to do some more research as to what this error means and from what I've researched so far this is whats making it throw the nullpointerexception. The error: Exception processing async thread queue On Aug 2, 5:33 pm, Justin Anderson janderson@gmail.com wrote: * 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.comandroid-beginners%2Bunsubscr i...@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. ATTENTION: Android-Beginners will be permanently disabled on August 9 2010. For more information about this change, please read [http://goo.gl/xkfl] or visit the Group home page. 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
[android-beginners] Re: NullPointerException when trying to create TelephonyManager
Ok, so the problem was that I was calling those methods before the application was fully created. So I did the getSystemService call inside of an onCreate method and all is well and dandy now. On Aug 3, 10:39 am, Wall-E bashee...@gmail.com wrote: Did some more searching and I found out that I am not getting the java async thread exception anymore but I'm still getting the NullPointerException. Anybody else know what I'm doing wrong? On Aug 3, 7:32 am, Wall-E bashee...@gmail.com wrote: Look specifically for a caused by line... Yes, in the caused by line is where I'm seeing the NullPointerException (don't worry I'm not making educated guesses). My subclassing of the Application class works, or at least it did before I added the instantiation of the TelophonyManager so I'm pretty sure there is nothing wrong in the Manifest file. The debugger was throwing some java async thread exception so I'm thinking something went haywire with eclipse but I need to do some more research as to what this error means and from what I've researched so far this is whats making it throw the nullpointerexception. The error: Exception processing async thread queue On Aug 2, 5:33 pm, Justin Anderson janderson@gmail.com wrote: * 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.comandroid-beginners%2Bunsubscr i...@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. ATTENTION: Android-Beginners will be permanently disabled on August 9 2010. For more information about this change, please read [http://goo.gl/xkfl] or visit the Group home page. 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
Re: [android-beginners] Re: NullPointerException when trying to create TelephonyManager
Glad you were able to figure it out! On Aug 3, 2010 1:11 PM, Wall-E bashee...@gmail.com wrote: Ok, so the problem was that I was calling those methods before the application was fully created. So I did the getSystemService call inside of an onCreate method and all is well and dandy now. On Aug 3, 10:39 am, Wall-E bashee...@gmail.com wrote: Did some more searching and I found out t... -- You received this message because you are subscribed to the Google Groups Android Beginners group. ATTENTION: Android-Beginners will be permanently disabled on August 9 2010. For more information about this change, please read [http://goo.gl/xkfl] or visit the Group home page. 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
[android-beginners] Re: NullPointerException when trying to create TelephonyManager
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 For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
Re: [android-beginners] Re: NullPointerException when trying to create TelephonyManager
* 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.comandroid-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