3 ms·
Actually, you can use the following on Android from Java 7 and 8: - Case/Switch Strings - Auto closing files handlers (via adding a few classes/interfaces). A
by yareally 13y ago
Actually, you can use the following on Android from Java 7 and 8:
- Case/Switch Strings
- Auto closing files handlers (via adding a few classes/interfaces). Also known as "try with resources"
- Integer literals
- Multiple exceptions in a catch block
- Lambdas via RetroLambda[2], which compiles Java 8 bytecode into 7 or 6
Used them all in several projects with 20-100k+ downloads with no user reported errors related to their usage. New Android projects though, I rather just use Scala, but older things I don't want to convert, I use the above to make Java easier to manage.
[1] https://github.com/yareally/Java7-on-Android https://github.com/yareally/Java7-on-Android (small guide I set up to explain how to add all the features above)
[2] https://github.com/orfjackal/retrolambda https://github.com/orfjackal/retrolambda
- pjmlp 13y agoIt is not official part of Android SDK, which only supports Java 6 officially, so not possible to use in our enterprise projects. Thanks for the tips, though.