Hello, I use a button to stop a service from running in my
application, but I got stuck when the application keeps crashing. Here
is the code and line 8  is the problem code I found by using
breakpoints, any suggestions?

public void onClick(View v)
        {
                switch (v.getId())
                {
                        case R.id.exit_collection_button:
                                this.finish();
                                Context context = getBaseContext();
8                               context.stopService(new Intent(this, 
CollectionService.class));//
**********

                                break;
                }

        }
Stack trace:
Thread [<3> main] (Suspended (exception RuntimeException))
        ActivityThread.handleStopService(IBinder) line: 2909
        ActivityThread.access$3600(ActivityThread, IBinder) line: 119
        ActivityThread$H.handleMessage(Message) line: 1929
        ActivityThread$H(Handler).dispatchMessage(Message) line: 99
        Looper.loop() line: 123
        ActivityThread.main(String[]) line: 4363
        Method.invokeNative(Object, Object[], Class, Class[], Class, int,
boolean) line: not available [native method]
        Method.invoke(Object, Object...) line: 521
        ZygoteInit$MethodAndArgsCaller.run() line: 860
        ZygoteInit.main(String[]) line: 618
        NativeStart.main(String[]) line: not available [native method]

thanks

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

Reply via email to