Hello,

I made a code for my understanding of Android Service class.
It has just a single Activity and Service in apk. Service is the same
as the sample code of API reference as below;
http://developer.android.com/intl/ja/reference/android/app/Service.html#LocalServiceSample

A client side is an Activity based on the above sample, and just added
the following code;
        public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.local_service_tset);

                CheckBox checkBox = (CheckBox) findViewById(R.id.checkbox);
                checkBox.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                                CheckBox cb = (CheckBox) v;
                                if (cb.isChecked()) {
                                        doBindService();
                                } else {
                                        doUnbindService();
                                }
                        }
                });
        }
My sample application has a check box which starts(binds)/unbind to
the local service on a single process. The local service instance is
created by every bind request (and destroyed by every unbind).

If I press the button repeatedly, then LocalService$LocalBinder is
leaked!!
The problem is not resolved even If I set an obtained binder to null
(like below).
                                } else {
                                        doUnbindService();
+                                       mBoundService = null;
                                }

Please help! How to resolve this problem?

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