Android Support in Groovy 2.4
Written by Kay Ewbank   
Thursday, 29 January 2015

Groovy 2.4  has been released with support for Android and there is also an update to its multi-purpose library SwissKnife which handles view injection and threading for Android using annotations. 

In addition to Android support, the Groovy team has also focused on improving the performance, memory consumption and reducing the bytecode generation.

Writing about the release on his blog, head developer Guillaume Laforge says that the Android support:

“allows developers to write Android applications fully using Groovy, with much less boilerplate code than raw Java”.

Other improvements that Laforge says are worth noting in this release include the fact that traits can use the @SelfType annotation with static type checking enabled to restrict to what classes traits can be applied.

Various GDK methods have been improved, including System.currentTimeSecond(), and List.getIndices(). Collection related methods have been moved to iterator-based variants to apply to all iterable collection types. Missing methods such as init(), dropRight(), and takeRight() have also been added.

There are some refinements to existing AST transformations, and more improvements to the Groovysh shell, including support for custom .rc and .profile scripts to be loaded on startup.

 swissknife

 

Fitting alongside the release of Groovy was an update to SwissKnife. This is a project that offers a number of Groovy code transformations that deal view injection and threading for Android using annotations.

The idea is that you leave SwissKnife to handle aspects such as handling UI and background threads and dealing with event handling, leaving you to concentrate on your own code. SwissKnife is based on both ButterKnife and AndroidAnnotations, and lets you inject views dynamically on any Object as long as you have a View to find them.

You can also add callback methods to several actions using @OnClick, @OnItemClick, etc; and execute methods in the UI Thread or a background one using @OnUIThread and @OnBackground. You can make your variables persistent across state changes without messing with onSaveInstanceState, and you can make anything Parcelable with the @Parcelable annotation - which can be used with @SaveInstance to automatize data persistence.

The release of Groovy 2.4 comes after Pivotal pulled out of funding Groovy and Grails, which means that the Groovy and Grails teams need to find new sponsors. In the meantime, while development on Groovy will continue, team members say they will only able to work on it in their spare time.

 

 

More Information

Groovy 2.4 Released

Groovy

Download Groovy 2,4

Groovy 2.4 Changelog

Related Articles

New Groovy 

Groovy And Grails Lose Sponsor 

Making Java Groovy (Manning) - Book Watch 

 

To be informed about new articles on I Programmer, install the I Programmer Toolbar, subscribe to the RSS feed, follow us on, Twitter, FacebookGoogle+ or Linkedin,  or sign up for our weekly newsletter.

 

Banner


iOS 17.4 Released With Support For App Stores In The EU
06/03/2024

I have written about Apple's approach to complying with regulation, characterizing it as malicious compliance. It also seems that Apple is a master of creating the unintended consequence and letting i [ ... ]



Google Donates $1M To Rust
26/02/2024

Google has made a donation of $1 million to The Rust Foundation. The contribution has been earmarked to underwrite the Interop Initiative: a new C++/Rust interoperability effort.


More News

 

raspberry pi books

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Sunday, 23 September 2018 )