@Override
 protected void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
   switch (resultCode) {
     case SUBACTIVITY_RESULTCODE_CHAINCLOSE_SUCCESS:
       this.setResult(SUBACTIVITY_RESULTCODE_CHAINCLOSE_SUCCESS, data);
       this.finish();
       break;
     case SUBACTIVITY_RESULTCODE_CHAINCLOSE_QUITTED:
       this.setResult(SUBACTIVITY_RESULTCODE_CHAINCLOSE_QUITTED, data);
       this.finish();
       break;
   }
   /* Finally call the super()-method. */
   super.onActivityResult(requestCode, resultCode, data);
 }
  /** Called when the activity is first created. */
  @Override
  public void onCreate(final Bundle icicle) {
    super.onCreate(icicle, true); // We need DataState-Info
    Preferences.applySharedSettings(this);
    this.setContentView(R.layout.sd_postcode_uk_bs_7666);

    /*
     * Save the Extras Bundle of the Intent this Activity was created with,
     * because it contains the Information, that will finally be used for a
     * GeoCode API.
     */
    this.bundleCreatedWith = this.getIntent().getExtras();

    final AbstractKeyBoardLayout aKeyBoardLayout =
        KeyBoardLayoutImpls.getNumberedVersion(Preferences.getKeyboardLayout(this));
    this.keyBoardGrid = (GridView) findViewById(R.id.grid_sd_postcode_uk_bs_7666_keyboard);
    this.keyBoardGrid.setNumColumns(
        aKeyBoardLayout.getColumnsByDisplay(getWindowManager().getDefaultDisplay()));

    this.postcodeEditText_1 = (EditText) findViewById(R.id.et_sd_postcode_uk_bs_7666_codeentered_1);
    this.postcodeEditText_2 = (EditText) findViewById(R.id.et_sd_postcode_uk_bs_7666_codeentered_2);
    this.lastFocusedPostcodeEditText = this.postcodeEditText_1;
    final OnFocusChangeListener lis =
        new OnFocusChangeListener() {

          @Override
          public void onFocusChange(final View v, final boolean hasFocus) {
            SDPostcodeUK_BS7666.this.lastFocusedPostcodeEditText = (EditText) v;
          }
        };
    this.postcodeEditText_1.setOnFocusChangeListener(lis);
    this.postcodeEditText_2.setOnFocusChangeListener(lis);

    /* Make the Country-Grid be filled with all Countries available. */
    this.keyBoardGrid.setAdapter(
        new KeyLayoutAdapter(this, aKeyBoardLayout, this.mGridButtonListener));

    this.applyTopMenuButtonListeners();
    this.applyOkButtonListener();
    this.applyAutoCompleteListeners();
    this.applyKeyPadGridOnItemClickListener();

    if (super.mMenuVoiceEnabled) {
      MediaPlayer.create(this, R.raw.enter_a_zipcode).start();
    }
  }