Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 862551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T09:09:40+00:00 2026-05-15T09:09:40+00:00

I’ve been trying to experiment with developing Android applications with Scala. I’ve gotten to

  • 0

I’ve been trying to experiment with developing Android applications with Scala.

I’ve gotten to the point where I can get the app to compile, but there are no helper functions for things like:

button.setOnClickListener( () => {
    text.setText("test")
})

(I’m talking about the closure there)

I see lots of references to scala-android.jar, and have this file in my project, but I’m not sure what it does, or how to use it. I get the feeling it has these helper conversion functions, but I’m not sure. Running jar -tvf scala-android.jar on the file gives me this:

401 Sun Jun 06 10:06:02 MDT 2010 scala/Function0$class.class
431 Sun Jun 06 10:06:02 MDT 2010 scala/Function0.class
572 Sun Jun 06 10:06:02 MDT 2010 scala/Function1.class
282 Sun Jun 06 10:06:02 MDT 2010 scala/ScalaObject$class.class
271 Sun Jun 06 10:06:02 MDT 2010 scala/ScalaObject.class
458 Sun Jun 06 10:06:02 MDT 2010 scala/runtime/BoxedUnit.class

If this isn’t what I’m looking for, is there a simple library that’ll do conversions for this kind of stuff?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T09:09:41+00:00Added an answer on May 15, 2026 at 9:09 am

    You may create your own, I found this is very easy and lightweight in Scala.

    Here is mine, just for your reference.

    trait FindView
    {
        this: Activity =>
    
        def findView [WidgetType] (id: Int) : WidgetType = {
            return findViewById (id).asInstanceOf[WidgetType]
        }
    
        implicit def listenerFromFunction (action: () => Any) = {
            new View.OnClickListener() {
                def onClick(v: View) {action ()}
            }
        }
    }
    

    Mix-in this into your Activity class, and you could do it just like your example.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 478k
  • Answers 478k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer We did a disposable class that changes the cursor for… May 16, 2026 at 5:37 am
  • Editorial Team
    Editorial Team added an answer To upload a file you need the server to accept… May 16, 2026 at 5:37 am
  • Editorial Team
    Editorial Team added an answer Change the type of response_array to string[]: string[] response_array =… May 16, 2026 at 5:37 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.