On Apr 17, 5:56 am, Asif k <asifk1...@gmail.com> wrote: > But if I am using the variables which are defined outside that > method ( in the same activity or same .apk) then my application throws > "java.lang.reflect.InvocationTargetException" at runtime. [...] > caused due to NullPointerException.
When you call a method through e.g. Method.invoke(), any exception thrown as a result of the call is wrapped in an InvocationTargetException. This is necessary because otherwise checked exceptions could be getting thrown with nothing to catch them. So the question is not why are you getting an InvocationTargetException, but rather why are you getting the NullPointerException. Which reference is null? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---