/** Crea una nueva identidad para un crypto customer */ private void createNewIdentityInBackDevice(String donde) { String customerNameText = mCustomerName.getText().toString(); if (customerNameText.trim().equals("")) { Toast.makeText(getActivity(), "The alias must not be empty", Toast.LENGTH_LONG).show(); } else { if (cryptoCustomerBitmap == null) { Toast.makeText(getActivity(), "You must enter an image", Toast.LENGTH_LONG).show(); } else { byte[] imgInBytes = ImagesUtils.toByteArray(cryptoCustomerBitmap); final CreateCustomerIdentityExecutor executor = new CreateCustomerIdentityExecutor(appSession, customerNameText, imgInBytes); int resultKey = executor.execute(); switch (resultKey) { case SUCCESS: if (donde.equalsIgnoreCase("OnClick")) { Toast.makeText(getActivity(), "Crypto Customer Identity Created.", Toast.LENGTH_LONG) .show(); changeActivity( Activities.CBP_SUB_APP_CRYPTO_CUSTOMER_IDENTITY, appSession.getAppPublicKey()); } new Thread() { @Override public void run() { try { appSession .getModuleManager() .publishCryptoCustomerIdentity(executor.getIdentity().getPublicKey()); } catch (CouldNotPublishCryptoCustomerException e) { Toast.makeText(getActivity(), "Error al publicar la identidad", Toast.LENGTH_LONG) .show(); } } }.start(); break; } } } }