Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to initialize LocalServiceConnection from a fragment #149

Open
ndarilek opened this issue Jun 16, 2016 · 2 comments
Open

How to initialize LocalServiceConnection from a fragment #149

ndarilek opened this issue Jun 16, 2016 · 2 comments

Comments

@ndarilek
Copy link

I have code like:

class MapFragment extends Fragment with Contexts[Fragment] with SharedPreferences.OnSharedPreferenceChangeListener {

  implicit var ctx:Context = _

  override def onActivate(a:Activity) {
    ctx = a
    val locationService = new LocalServiceConnection[LocationService]
    locationService.onConnected {
...

But I get:

/home/nolan/Projects/Hermes/src/main/scala/android/ui.scala:371: could not find implicit value for parameter reg: org.scaloid.common.Registerable
Error occurred in an application involving default arguments.
    val locationService = new LocalServiceConnection[LocationService]
                          ^

How do I make this custom Fragment a Registerable?

Thanks.

@pocorall
Copy link
Owner

pocorall commented Jul 5, 2016

Missing part is an implicit value of Registerable:

implicit val reg = new Registerable {
  def onRegister(body: => Any) = ???
  def onRegister(body: => Any) = ???
}

You can easily write one for yourself when you refer the implementation for SActivity.

@ndarilek
Copy link
Author

ndarilek commented Jul 9, 2016 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants