Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); DefaultAuthenticationChallengeHandler handler = new DefaultAuthenticationChallengeHandler(this); AuthenticationManager.setAuthenticationChallengeHandler(handler); final Portal portal = new Portal("<LINK_0>", true); portal.addDoneLoadingListener(new Runnable() { @Override public void run() { if (portal.getLoadStatus() == LoadStatus.LOADED) { PortalInfo portalInformation = portal.getPortalInfo(); String portalName = portalInformation.getPortalName(); urlText = (TextView)findViewById(R.id.portal); urlText.setText(portalName); PortalUser user = portal.getUser(); String userName = user.getFullName(); userText = (TextView)findViewById(R.id.userName); userText.setText(userName); String email = user.getEmail(); emailText = (TextView)findViewById(R.id.email); emailText.setText(email); Calendar startDate = user.getCreated(); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String formatDate = simpleDateFormat.format(startDate.getTime()); createDate = (TextView)findViewById(R.id.create_date); createDate.setText(formatDate); if (user.getThumbnailFileName() == null) { return; } final ListenableFuture<byte[]> thumbnailFuture = user.fetchThumbnailAsync(); thumbnailFuture.addDoneListener(new Runnable() { @Override public void run() { byte[] itemThumbnailData; try { itemThumbnailData = thumbnailFuture.get(); if ((itemThumbnailData != null) && (itemThumbnailData.length > 0)) { Bitmap itemThumbnail = BitmapFactory.decodeByteArray(itemThumbnailData, 0, itemThumbnailData.length); userImage = (ImageView)findViewById(R.id.userImage); userImage.setImageBitmap(itemThumbnail); } } catch (InterruptedException | ExecutionException e) { Log.d("TEST", e.getMessage()); } } }); } } }); portal.loadAsync(); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); DefaultAuthenticationChallengeHandler handler = new DefaultAuthenticationChallengeHandler(this); AuthenticationManager.setAuthenticationChallengeHandler(handler); final Portal portal = new Portal("<LINK_0>", true); portal.addDoneLoadingListener(new Runnable() { @Override public void run() { if (portal.getLoadStatus() == LoadStatus.LOADED) { PortalInfo portalInformation = portal.getPortalInfo(); String portalName = portalInformation.getPortalName(); portalNameText = (TextView) findViewById(R.id.portal); portalNameText.setText(portalName); if(portal.getUser() != null){ PortalUser user = portal.getUser(); String userName = user.getFullName(); userText = (TextView) findViewById(R.id.userName); userText.setText(userName); String email = user.getEmail(); emailText = (TextView) findViewById(R.id.email); emailText.setText(email); Calendar startDate = user.getCreated(); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String formatDate = simpleDateFormat.format(startDate.getTime()); createDate = (TextView) findViewById(R.id.create_date); createDate.setText(formatDate); if (user.getThumbnailFileName() == null) { return; } final ListenableFuture<byte[]> thumbnailFuture = user.fetchThumbnailAsync(); thumbnailFuture.addDoneListener(new Runnable() { @Override public void run() { byte[] itemThumbnailData; try { itemThumbnailData = thumbnailFuture.get(); if ((itemThumbnailData != null) && (itemThumbnailData.length > 0)) { Bitmap itemThumbnail = BitmapFactory.decodeByteArray(itemThumbnailData, 0, itemThumbnailData.length); userImage = (ImageView) findViewById(R.id.userImage); userImage.setImageBitmap(itemThumbnail); } } catch (InterruptedException | ExecutionException e) { Log.d("TEST", e.getMessage()); } } }); } else { Toast.makeText(getApplicationContext(), "User did not authenticate against " + portalName, Toast.LENGTH_LONG).show(); } } } }); portal.loadAsync(); }