title: How to finish activity after authentication success
body: <p>I'm trying to finish the login activity after the fingerAuthentification success, I have tried using "finish()" and "finishAffinity()" but I get an error "cannot resolver method finish() or finishAffinity()</p>
  
  <pre><code>@TargetApi(Build.VERSION_CODES.M)
  public class FingerprintHandler extends FingerprintManager.AuthenticationCallback {
  
      private CancellationSignal cancellationSignal;
      private Context context;
  
      public FingerprintHandler(Context mcontext) { context = mcontext; }
  
      public void startAuth(FingerprintManager manager, FingerprintManager.CryptoObject cryptoObject) {
          cancellationSignal = new CancellationSignal();
          if (ActivityCompat.checkSelfPermission(context, Manifest.permission.USE_FINGERPRINT) != PackageManager.PERMISSION_GRANTED) {
              return;
          }
          manager.authenticate(cryptoObject, cancellationSignal, 0, this, null);
      }
  
      @Override
      public void onAuthenticationError(int errMsgId, CharSequence errString) {
          Toast.makeText(context,"Authentication error\n" + errString, Toast.LENGTH_LONG).show();
      }
  
      @Override
      public void onAuthenticationFailed() {
          Toast.makeText(context, "Authentication failed", Toast.LENGTH_LONG).show();
      }
  
      public void onAuthenticationHelp(int helpMsgId, CharSequence helpString) {
          Toast.makeText(context, "Authentication help\n" + helpString, Toast.LENGTH_SHORT).show();
      }
  
      @Override
      public void onAuthenticationSucceeded(FingerprintManager.AuthenticationResult result) {
          Toast.makeText(context, "Authentication Success!!", Toast.LENGTH_SHORT).show();
          Handler hd = new Handler();
          hd.postDelayed(new Runnable() {
              @Override
              public void run() {
                  context.startActivity(new Intent(context, MainActivity.class));
                  FingerLogin.finish();
              }
          }, 2000);
      }
  }
  </code></pre>