private Bidder join(XMPPAuctionHouse house, String itemId) throws AuctionIsNotAvailable { Auction auction = house.auctionFor(itemId); Bidder bidder = new Bidder(auction); auction.addAuctionEventListener(bidder); bidder.addBidderListener(new UIThreadBidderListener(new BidderDisplayer())); bidder.join(); bidder.setIdImage(idImages[idSelect]); return bidder; }
@Override protected JoinResult doInBackground(String... params) { try { XMPPAuctionHouse house = XMPPAuctionHouse.login(params[0], params[1], params[2]); Bidder bidder = join(house, AUCTION_ITEM_ID); return JoinResult.ok(bidder); } catch (AuctionIsNotAvailable e) { return JoinResult.failed(getString(R.string.failed_to_join)); } catch (AuctionIsNotAccessible e) { return JoinResult.failed(getString(R.string.failed_to_connect)); } catch (AuctionLoginFailure e) { return JoinResult.failed(getString(R.string.failed_to_login)); } }