No one will be able to help you because we don't know which line is
477 in your MainActivity.java file.  You should probably just find
that line yourself and diagnose the problem with a debugger.

Doug

On Feb 8, 12:52 am, Dhaval Varia <[email protected]> wrote:
> *Dear all
>
> I have developed my application on target "Google API Level 8" i have
> tested it on ginger bird.and it works quit fine.
>
> Now i am trying to testing it on "Google API Level 7".
>
> All works fine.
>
> but Phone call Gives following error:
>
> 02-08 13:57:54.713: ERROR/AndroidRuntime(320): Uncaught handler: thread
> main exiting due to uncaught exception
> 02-08 13:57:54.723: ERROR/AndroidRuntime(320):
> java.lang.NullPointerException
> 02-08 13:57:54.723: ERROR/AndroidRuntime(320):     at
> android.app.ApplicationContext.stopService(ApplicationContext.java:778)
> 02-08 13:57:54.723: ERROR/AndroidRuntime(320):     at
> android.content.ContextWrapper.stopService(ContextWrapper.java:331)
> 02-08 13:57:54.723: ERROR/AndroidRuntime(320):     at com.example.
> .MainActivity$5.onCallStateChanged(MainActivity.java:477)
> 02-08 13:57:54.723: ERROR/AndroidRuntime(320):     at
> android.telephony.PhoneStateListener$2.handleMessage(PhoneStateListener.java:303)
> 02-08 13:57:54.723: ERROR/AndroidRuntime(320):     at
> android.os.Handler.dispatchMessage(Handler.java:99)
> 02-08 13:57:54.723: ERROR/AndroidRuntime(320):     at
> android.os.Looper.loop(Looper.java:123)
> 02-08 13:57:54.723: ERROR/AndroidRuntime(320):     at
> android.app.ActivityThread.main(ActivityThread.java:4363)
> 02-08 13:57:54.723: ERROR/AndroidRuntime(320):     at
> java.lang.reflect.Method.invokeNative(Native Method)
> 02-08 13:57:54.723: ERROR/AndroidRuntime(320):     at
> java.lang.reflect.Method.invoke(Method.java:521)
> 02-08 13:57:54.723: ERROR/AndroidRuntime(320):     at
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
> 02-08 13:57:54.723: ERROR/AndroidRuntime(320):     at
> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
> 02-08 13:57:54.723: ERROR/AndroidRuntime(320):     at
> dalvik.system.NativeStart.main(Native Method)
>
> My code is :
>
> private void MakePhoneCall() {
>         try
>         {
>                     //Take desicion based on phone state
>                     TelephonyManager
> telmanager=(TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
>                     telmanager.listen(new PhoneStateListener(){
>
>                             public void onCallStateChanged(int state,String
> incomingnumber){
>                                 //string newstate=getCallStateString(state);
>                                 if(state==TelephonyManager.CALL_STATE_IDLE)
>                                 {
>                                     if(PhoneNocount>0)
>                                     {
>                                         if(CellNo[PhoneNocount] != "")
>                                          {
>                                               CellToDial = "tel:"
> +CellNo[PhoneNocount];
>                                               Uri
> number=Uri.parse(CellToDial);
>                                              dial=new Intent
> (Intent.ACTION_CALL,number);
>                                               startActivity(dial);
>                                               PhoneNocount--;
>                                          }
>                                         else
>                                         {
>                                             appendLog(" MainActivity :Call
> :"+CellNo[PhoneNocount]);
>                                         }
>                                     }
>                                     else
>                                     {
>                                         stopService(dial);
>                                     }
>
>                                 }
>                             }
>                     }
>
>                         ,PhoneStateListener.LISTEN_CALL_STATE);
>         }
>         catch(Exception e)
>         {
>             Log.v("Error",e.toString());
>         }
>     }
>
> I think onCallStateChanged fires this exception....
>
> I dont know where i am wrong..
>
> .Please Help
>
> :)
>
> Thanks & Best Regards.
> ----------------------------------------------------------------------------------------
> Dhaval varia*
> *Assistant Professor *
> *Govt Engineering College,Modasa
> (9924343883)
> *
> *
> *

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