Hello,

First, apologize for my bad english.

I'm new using the android SDK, I read some tutorials and look into
some code but I found the answer of this question nowhere for now.

I have a View (LinearLayout) which contains a TextView and a CheckBox.
This view is used by a ListActivity (see the Google Alarm Clock, main
activity).

I'm also using a custom adapter (extends BaseAdapter) which creates
several instances of this view (through the getView method).
Then, when I click on the checkbox, the UI state change. I can add a
listener on the checkbox, it works too.

The question : I want to persist the checkbox state. I don't want to
access directly the data store from every listeners I will have in my
application. I found that not very "clean". I would prefer using a
'service' which know to persist the data. The problem is I don't know
how get the instance (skeleton for now, maybe injected later if
possible) to this service. I can set the service through the view
constructor, ask a static helper to retreive the service, use getParent
()...getParent()  then cast to find a reference to the service on the
activity, etc. What is the best practice to do that ?

Have you an example ?
Thanks a lot !

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