package net.redwarp.library.testapplication;

import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;
import android.widget.TextView;

import butterknife.Bind;
import butterknife.ButterKnife;


public class DetailActivity extends AppCompatActivity {

  @Bind(R.id.text) TextView mTextView;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_detail);
    ButterKnife.bind(this);
    if (getActionBar() != null) {
      getActionBar().setDisplayHomeAsUpEnabled(true);
    }

    long userId = getIntent().getLongExtra(MainActivity.EXTRA_USER_ID, -1);
    if (userId != -1) {
      RandomUser user = TestApplication.getDatabaseHelper().getWithId(RandomUser.class, userId);
      if (user != null) {
        mTextView.setText(user.name);
      }
    }
  }

  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      // Respond to the action bar's Up/Home button
      case android.R.id.home:
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
          finishAfterTransition();
        } else {
          finish();
        }
        return true;
    }
    return super.onOptionsItemSelected(item);
  }
}

@@ -59,19 +59,20 @@
 id.os.Bu
-ild
+ndle
 ;%0Aimport
@@ -76,33 +76,53 @@
 ort android.
-os.Bundle
+support.v4.app.ActivityCompat
 ;%0Aimport and
@@ -1130,150 +1130,51 @@
     
-if (Build.VERSION.SDK_INT %3E= Build.VERSION_CODES.LOLLIPOP) %7B%0A          finishAfterTransition();%0A        %7D else %7B%0A          finish();%0A        %7D
+ActivityCompat.finishAfterTransition(this);
 %0A   

Use ActivityCompat instead of reinventing the wheel