Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gfx/lambdaandroid
https://github.com/gfx/lambdaandroid
Last synced: 26 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/gfx/lambdaandroid
- Owner: gfx
- Created: 2014-03-19T02:22:36.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-03-19T02:25:07.000Z (over 10 years ago)
- Last Synced: 2023-04-09T21:19:20.024Z (over 1 year ago)
- Language: Shell
- Size: 254 KB
- Stars: 9
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## LetroLambda works on Android!
祝!Java8 release(2014/3/18)!lambda式バンザイ!
lambda式はcallback styleのAPIと非常に相性がいいので、これからのMBaaS SDK設計は大きく変わるはず。
[@zaki50: retrolambda https://github.com/evant/gradle-retrolambda … 組み込んだ gradle のプロジェクトにしたら Android で lambda 使えた! https://gist.github.com/zaki50/c16db7cb29cee0a5e364 … ](https://twitter.com/zaki50/status/445569652941258752)
https://github.com/evant/gradle-retrolambda
というわけで、retrolambdaを使ってAndroidでλ式を使ってみました。
`app/build.gradle` をちょろっと設定するだけで…
```groovy
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'me.tatarka:gradle-retrolambda:1.3.0'
}
}apply plugin: 'android'
apply plugin: 'retrolambda'retrolambda {
jdk "/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home"
}android {
...compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}...
}```
`minSdkVersion 8` でも lambda式が使える!YATTA!
```java
findViewById(R.id.hello).setOnClickListener((view) -> {
Toast.makeText(getApplication(), "Yeah!", Toast.LENGTH_LONG).show();
});
```