Skip to content

Instantly share code, notes, and snippets.

@up1
Last active April 18, 2016 08:07
Show Gist options
  • Select an option

  • Save up1/4c3e0b0ff918cc4e51d65879ff82afd8 to your computer and use it in GitHub Desktop.

Select an option

Save up1/4c3e0b0ff918cc4e51d65879ff82afd8 to your computer and use it in GitHub Desktop.
Demo :: Java8 in android with jack compiler
android {
compileSdkVersion 'android-N'
buildToolsVersion "24.0.0-rc3"
defaultConfig {
applicationId "up1.demoandroidn"
minSdkVersion 24
targetSdkVersion 24
versionCode 1
versionName "1.0"
jackOptions{
enabled true
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button clickMeButton = (Button) findViewById(R.id.clickMeButton);
clickMeButton.setOnClickListener(view -> {
makeText(MainActivity.this, "Hello", Toast.LENGTH_LONG).show();
}
);
}
}
public interface Money {
void setMoney(BigDecimal money);
BigDecimal getMoney();
String getCurentcy();
default String getFormattedMoney() {
return String.format(Locale.getDefault(),
"Money is %.3f %s", getMoney().floatValue(), getCurentcy());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment