package io.github.droidkaigi.confsched2017.view.activity;

import android.content.Intent;
import android.databinding.DataBindingUtil;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

import io.github.droidkaigi.confsched2017.R;
import io.github.droidkaigi.confsched2017.databinding.ActivitySplashBinding;

public class SplashActivity extends AppCompatActivity {

    private static final String TAG = SplashActivity.class.getSimpleName();

    private ActivitySplashBinding binding;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = DataBindingUtil.setContentView(this, R.layout.activity_splash);

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            findViewById(android.R.id.content).setSystemUiVisibility(
                    View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
        }

        final ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor();
        scheduledExecutorService.scheduleAtFixedRate(
                () -> binding.particleAnimationView.postInvalidate(),
                0L,
                40L,
                TimeUnit.MILLISECONDS);

        new Handler().postDelayed(() -> {
            scheduledExecutorService.shutdown();
            startActivity(new Intent(SplashActivity.this, MainActivity.class));
        }, 3000);

    }

}

@@ -712,16 +712,369 @@
 binding;
+%0A    private final ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor();%0A    private final Handler handler = new Handler();%0A    private final Runnable moveActivityRunnable = () -%3E %7B%0A        scheduledExecutorService.shutdown();%0A        startActivity(new Intent(SplashActivity.this, MainActivity.class));%0A    %7D;
 %0A%0A    @O
@@ -1515,120 +1515,8 @@
  %7D%0A%0A
-        final ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor();%0A
     
@@ -1725,29 +1725,23 @@
         
-new H
+h
 andler
-()
 .postDel
@@ -1749,163 +1749,166 @@
 yed(
-() -%3E %7B
+moveActivityRunnable, 3000);
 %0A    
+%7D%0A%0A
     
-    scheduledExecutorService.shutdown();%0A            startActivity(new Intent(SplashActivity.this, MainActivity.class));%0A        %7D, 3000);%0A
+@Override%0A    protected void onStop() %7B%0A        super.onStop();%0A        handler.removeCallbacks(moveActivityRunnable);
 %0A   

Fix Runnabe stop if press back button