code: private void finishActivity(Activity activity){
  		if(activity != null) {
  			try{
  				activity.finish();
  			}catch(Throwable e){
  				e.printStackTrace();
  			}
  		}
  	}
docs: Finishes an activity.
  
  @param activity the activity to finish