List of usage examples for android.text Html fromHtml
@Deprecated public static Spanned fromHtml(String source)
From source file:com.adrup.saldo.bank.nordea.NordeaManager.java
@Override public Map<AccountHashKey, RemoteAccount> getAccounts(Map<AccountHashKey, RemoteAccount> accounts) throws BankException { Log.d(TAG, "-> getAccounts()"); HttpClient httpClient = new SaldoHttpClient(mContext); try {/*from www . j a v a2 s . c o m*/ // Do login List<NameValuePair> parameters = new ArrayList<NameValuePair>(3); //parameters.add(new BasicNameValuePair(TOKEN_PARAM, token)); parameters.add(new BasicNameValuePair(USER_PARAM, mBankLogin.getUsername())); parameters.add(new BasicNameValuePair(PASS_PARAM, mBankLogin.getPassword())); parameters.add(new BasicNameValuePair(OBJECT_PARAM, "TT00")); parameters.add(new BasicNameValuePair(CHECKCODE_PARAM, Integer.toString(((int) (System.currentTimeMillis() / 1000L))) + "123")); Log.d(TAG, "logging in..."); String res = HttpHelper.post(httpClient, LOGIN_URL, parameters); //TODO: use regexp to grab swedbank err text if (res.contains("Tekniskt fel")) { //login failed.. bail throw new AuthenticationException("auth fail"); } //ACCOUNTS Log.d(TAG, "getting account info..."); res = HttpHelper.get(httpClient, ACCOUNTS_URL); //Log.d(TAG, "accounts html dump:"); //Log.d(TAG, res); Pattern pattern = Pattern.compile(ACCOUNTS_REGEX); Matcher matcher = pattern.matcher(res); int ordinal = 1; while (matcher.find()) { String remoteId = matcher.group(1); ordinal = Integer.parseInt(matcher.group(1)); String name = Html.fromHtml(matcher.group(2)).toString(); long balance = Long.parseLong(matcher.group(3).replaceAll("\\,|\\.", "")) / 100; accounts.put(new AccountHashKey(remoteId, mBankLogin.getId()), new Account(remoteId, mBankLogin.getId(), ordinal, name, balance)); } //CREDIT CARDS Log.d(TAG, "getting account info..."); String res2 = HttpHelper.get(httpClient, CREDITS_URL); //Log.d(TAG, "accounts html dump:"); //Log.d(TAG, res); pattern = Pattern.compile(CREDITS_REGEX); matcher = pattern.matcher(res2); int i = ordinal; while (matcher.find()) { ordinal = ++i; int remoteId = ordinal + 100; // we need a unique remoteId per bank login String name = Html.fromHtml(matcher.group(1)).toString(); long balance = Long.parseLong(matcher.group(2).replaceAll("\\,|\\.", "")) / 100; accounts.put(new AccountHashKey(String.valueOf(remoteId), mBankLogin.getId()), new Account(String.valueOf(remoteId), mBankLogin.getId(), ordinal, name, balance)); } //FONDER pattern = Pattern.compile(FOND_REGEX); matcher = pattern.matcher(res); i = ordinal; while (matcher.find()) { ordinal = ++i; int remoteId = ordinal + 200; String name = Html.fromHtml(matcher.group(1)).toString(); long balance = Long.parseLong(matcher.group(2).replaceAll("\\,|\\.", "")) / 100; accounts.put(new AccountHashKey(String.valueOf(remoteId), mBankLogin.getId()), new Account(String.valueOf(remoteId), mBankLogin.getId(), ordinal, name, balance)); } //accounts.put(Integer.valueOf("5"), new Account(5, 5, "test", 2323)); } catch (IOException e) { Log.e(TAG, e.getMessage(), e); throw new NordeaException(e.getMessage(), e); } catch (HttpException e) { Log.e(TAG, e.getMessage(), e); throw new NordeaException(e.getMessage(), e); } Log.d(TAG, "<- getAccounts()"); return accounts; }
From source file:com.liato.bankdroid.banking.banks.Swedbank.java
@Override public void update() throws BankException, LoginException { super.update(); if (username == null || password == null || username.length() == 0 || password.length() == 0) { throw new LoginException(res.getText(R.string.invalid_username_password).toString()); }//from w w w. j a v a2 s . com urlopen = login(); String response = null; Matcher matcher; try { response = urlopen.open("https://mobilbank.swedbank.se/banking/swedbank/accounts.html"); matcher = reAccounts.matcher(response); while (matcher.find()) { Account account = new Account(Html.fromHtml(matcher.group(3)).toString(), Helpers.parseBalance(matcher.group(4)), matcher.group(1).trim() == "loan" ? "l:" + matcher.group(2).trim() : matcher.group(2).trim()); if (matcher.group(1).trim() == "loan") { account.setType(Account.LOANS); } else { balance = balance.add(Helpers.parseBalance(matcher.group(4))); } accounts.add(account); } matcher = reLinklessAccounts.matcher(response); int accid = 0; while (matcher.find()) { Account account = new Account(Html.fromHtml(matcher.group(1)).toString(), Helpers.parseBalance(matcher.group(2)), "ll:" + accid); account.setType(Account.OTHER); accounts.add(account); accid++; } if (accounts.isEmpty()) { throw new BankException(res.getText(R.string.no_accounts_found).toString()); } // Konungens konto //accounts.add(new Account("Personkonto", Helpers.parseBalance("85351"), "0")); //accounts.add(new Account("Sparkonto", Helpers.parseBalance("8590700"), "1")); } catch (ClientProtocolException e) { throw new BankException(e.getMessage()); } catch (IOException e) { throw new BankException(e.getMessage()); } finally { super.updateComplete(); } }
From source file:com.liato.bankdroid.banking.banks.Steam.java
@Override public void update() throws BankException, LoginException, BankChoiceException { super.update(); if (username == null || password == null || username.length() == 0 || password.length() == 0) { throw new LoginException(res.getText(R.string.invalid_username_password).toString()); }/*w ww. j a v a 2 s . c o m*/ urlopen = login(); Matcher matcher = reBalance.matcher(response); if (matcher.find()) { /* * Capture groups: * GROUP EXAMPLE DATA * 1: Amount 0,--€ * */ String amount = Html.fromHtml(matcher.group(1)).toString().trim().replace("--", "00"); Account account = new Account("Wallet", Helpers.parseBalance(amount), "1"); String currency = Helpers.parseCurrency(amount, "USD"); this.setCurrency(currency); account.setCurrency(currency); balance = balance.add(Helpers.parseBalance(amount)); ArrayList<Transaction> transactions = new ArrayList<Transaction>(); matcher = reTransactions.matcher(response); while (matcher.find()) { /* * Capture groups: * GROUP EXAMPLE DATA * 1: Date 18 Oct 2007 * 2: Amount 0,99€ * 3: Event Purchase * 4: Item Team Fortress 2 * 5: Sub item Mann Co. Supply Crate Key * */ SimpleDateFormat sdfFrom = new SimpleDateFormat("d MMM yyyy"); SimpleDateFormat sdfTo = new SimpleDateFormat("yyyy-MM-dd"); Date transactionDate; try { transactionDate = sdfFrom.parse(matcher.group(1).trim()); String strDate = sdfTo.format(transactionDate); BigDecimal price = Helpers .parseBalance(Html.fromHtml(matcher.group(2)).toString().trim().replace("--", "00")); if ("Purchase".equalsIgnoreCase(matcher.group(3).trim())) { price = price.negate(); } transactions.add(new Transaction(strDate, Html.fromHtml(matcher.group(4)).toString().trim() + (Html.fromHtml(matcher.group(5)).toString().trim().length() > 1 ? " (" + Html.fromHtml(matcher.group(5)).toString().trim() + ")" : ""), price, Helpers.parseCurrency(Html.fromHtml(matcher.group(2)).toString().trim(), "USD"))); } catch (ParseException e) { Log.e(TAG, "Unable to parse date: " + matcher.group(1).trim()); } } Collections.sort(transactions, Collections.reverseOrder()); account.setTransactions(transactions); accounts.add(account); } if (accounts.isEmpty()) { throw new BankException(res.getText(R.string.no_accounts_found).toString()); } super.updateComplete(); }
From source file:com.android.gallery3d.filtershow.info.InfoPanel.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (getDialog() != null) { getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE); }//from www . j a va2 s. co m mMainView = (LinearLayout) inflater.inflate(R.layout.filtershow_info_panel, null, false); mImageThumbnail = (ImageView) mMainView.findViewById(R.id.imageThumbnail); Bitmap bitmap = MasterImage.getImage().getFilteredImage(); mImageThumbnail.setImageBitmap(bitmap); mImageName = (TextView) mMainView.findViewById(R.id.imageName); mImageSize = (TextView) mMainView.findViewById(R.id.imageSize); mExifData = (TextView) mMainView.findViewById(R.id.exifData); TextView exifLabel = (TextView) mMainView.findViewById(R.id.exifLabel); HistogramView histogramView = (HistogramView) mMainView.findViewById(R.id.histogramView); histogramView.setBitmap(bitmap); Uri uri = MasterImage.getImage().getUri(); String path = ImageLoader.getLocalPathFromUri(getActivity(), uri); Uri localUri = null; if (path != null) { localUri = Uri.parse(path); } if (localUri != null) { mImageName.setText(localUri.getLastPathSegment()); } Rect originalBounds = MasterImage.getImage().getOriginalBounds(); mImageSize.setText("" + originalBounds.width() + " x " + originalBounds.height()); List<ExifTag> exif = MasterImage.getImage().getEXIF(); String exifString = ""; boolean hasExifData = false; if (exif != null) { for (ExifTag tag : exif) { exifString += createStringFromIfFound(tag, ExifInterface.TAG_MODEL, R.string.filtershow_exif_model); exifString += createStringFromIfFound(tag, ExifInterface.TAG_APERTURE_VALUE, R.string.filtershow_exif_aperture); exifString += createStringFromIfFound(tag, ExifInterface.TAG_FOCAL_LENGTH, R.string.filtershow_exif_focal_length); exifString += createStringFromIfFound(tag, ExifInterface.TAG_ISO_SPEED_RATINGS, R.string.filtershow_exif_iso); exifString += createStringFromIfFound(tag, ExifInterface.TAG_SUBJECT_DISTANCE, R.string.filtershow_exif_subject_distance); exifString += createStringFromIfFound(tag, ExifInterface.TAG_DATE_TIME_ORIGINAL, R.string.filtershow_exif_date); exifString += createStringFromIfFound(tag, ExifInterface.TAG_F_NUMBER, R.string.filtershow_exif_f_stop); exifString += createStringFromIfFound(tag, ExifInterface.TAG_EXPOSURE_TIME, R.string.filtershow_exif_exposure_time); exifString += createStringFromIfFound(tag, ExifInterface.TAG_COPYRIGHT, R.string.filtershow_exif_copyright); hasExifData = true; } } if (hasExifData) { exifLabel.setVisibility(View.VISIBLE); mExifData.setText(Html.fromHtml(exifString)); } else { exifLabel.setVisibility(View.GONE); } return mMainView; }
From source file:net.networksaremadeofstring.rhybudd.ViewZenossEvent.java
/** Called when the activity is first created. */ @Override/* w ww . j a v a2s . c o m*/ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); BugSenseHandler.initAndStartSession(ViewZenossEvent.this, "44a76a8c"); settings = PreferenceManager.getDefaultSharedPreferences(this); setContentView(R.layout.view_zenoss_event); try { actionbar = getActionBar(); actionbar.setDisplayHomeAsUpEnabled(true); actionbar.setHomeButtonEnabled(true); } catch (Exception e) { BugSenseHandler.sendExceptionMessage("ViewZenossEvent", "OnCreate", e); } try { ((TextView) findViewById(R.id.EventTitle)).setText(getIntent().getStringExtra("Device")); ((TextView) findViewById(R.id.Summary)).setText(Html.fromHtml(getIntent().getStringExtra("Summary"))); ((TextView) findViewById(R.id.LastTime)).setText(getIntent().getStringExtra("LastTime")); ((TextView) findViewById(R.id.EventCount)) .setText("Count: " + Integer.toString(getIntent().getIntExtra("Count", 0))); } catch (Exception e) { //We don't need to much more than report it because the direct API request will sort it out for us. BugSenseHandler.sendExceptionMessage("ViewZenossEvent", "OnCreate", e); } firstLoadHandler = new Handler() { public void handleMessage(Message msg) { dialog.dismiss(); try { if (EventObject.has("result") && EventObject.getJSONObject("result").getBoolean("success") == true) { //Log.i("Event",EventObject.toString(3)); TextView Title = (TextView) findViewById(R.id.EventTitle); TextView Component = (TextView) findViewById(R.id.Componant); TextView EventClass = (TextView) findViewById(R.id.EventClass); TextView Summary = (TextView) findViewById(R.id.Summary); TextView FirstTime = (TextView) findViewById(R.id.FirstTime); TextView LastTime = (TextView) findViewById(R.id.LastTime); LinearLayout logList; EventDetails = EventObject.getJSONObject("result").getJSONArray("event").getJSONObject(0); try { if (EventDetails.getString("eventState").equals("Acknowledged")) { ((ImageView) findViewById(R.id.ackIcon)) .setImageResource(R.drawable.ic_acknowledged); } } catch (Exception e) { e.printStackTrace(); } //Log.e("EventDetails",EventDetails.toString(3)); try { Title.setText(EventDetails.getString("device_title")); } catch (Exception e) { Title.setText("Unknown Device - Event Details"); } try { Component.setText(EventDetails.getString("component")); } catch (Exception e) { Component.setText("Unknown Component"); } try { EventClass.setText(EventDetails.getString("eventClassKey")); } catch (Exception e) { EventClass.setText("Unknown Event Class"); } try { ImageView img = (ImageView) findViewById(R.id.summaryImage); URLImageParser p = new URLImageParser(img, ViewZenossEvent.this, Summary); Spanned htmlSpan = Html.fromHtml(EventDetails.getString("message"), p, null); Summary.setText(htmlSpan); //Summary.setText(Html.fromHtml(EventDetails.getString("message"))); //((ImageView) findViewById(R.id.summaryImage)).setImageDrawable(p.drawable); //Log.i("Summary",EventDetails.getString("message")); //((TextView) findViewById(R.id.Summary)).setVisibility(View.GONE); //((WebView) findViewById(R.id.summaryWebView)).loadData(EventDetails.getString("message"), "text/html", null); //((WebView) findViewById(R.id.summaryWebView)).loadDataWithBaseURL(null, EventDetails.getString("message"), "text/html", "UTF-8", "about:blank"); try { Summary.setMovementMethod(LinkMovementMethod.getInstance()); } catch (Exception e) { //Worth a shot } } catch (Exception e) { Summary.setText("No Summary available"); } try { FirstTime.setText(EventDetails.getString("firstTime")); } catch (Exception e) { FirstTime.setText("No Start Date Provided"); } try { LastTime.setText(EventDetails.getString("stateChange")); } catch (Exception e) { LastTime.setText("No Recent Date Provided"); } try { ((TextView) findViewById(R.id.EventCount)) .setText("Count: " + EventDetails.getString("count")); } catch (Exception e) { ((TextView) findViewById(R.id.EventCount)).setText("Count: ??"); } try { ((TextView) findViewById(R.id.Agent)).setText(EventDetails.getString("agent")); } catch (Exception e) { ((TextView) findViewById(R.id.Agent)).setText("unknown"); } try { JSONArray Log = EventDetails.getJSONArray("log"); int LogEntryCount = Log.length(); logList = (LinearLayout) findViewById(R.id.LogList); if (LogEntryCount == 0) { /*String[] LogEntries = {"No log entries could be found"}; ((ListView) findViewById(R.id.LogList)).setAdapter(new ArrayAdapter<String>(ViewZenossEvent.this, R.layout.search_simple,LogEntries));*/ TextView newLog = new TextView(ViewZenossEvent.this); newLog.setText("No log entries could be found"); logList.addView(newLog); } else { LogEntries = new String[LogEntryCount]; for (int i = 0; i < LogEntryCount; i++) { //LogEntries[i] = Log.getJSONArray(i).getString(0) + " set " + Log.getJSONArray(i).getString(2) +"\nAt: " + Log.getJSONArray(i).getString(1); TextView newLog = new TextView(ViewZenossEvent.this); newLog.setText(Html.fromHtml("<strong>" + Log.getJSONArray(i).getString(0) + "</strong> wrote " + Log.getJSONArray(i).getString(2) + "\n<br/><strong>At:</strong> " + Log.getJSONArray(i).getString(1))); newLog.setPadding(0, 6, 0, 6); logList.addView(newLog); } /*try { ((ListView) findViewById(R.id.LogList)).setAdapter(new ArrayAdapter<String>(ViewZenossEvent.this, R.layout.search_simple,LogEntries)); } catch(Exception e) { Toast.makeText(getApplicationContext(), "There was an error trying process the log entries for this event.", Toast.LENGTH_SHORT).show(); }*/ } } catch (Exception e) { TextView newLog = new TextView(ViewZenossEvent.this); newLog.setText("No log entries could be found"); newLog.setPadding(0, 6, 0, 6); ((LinearLayout) findViewById(R.id.LogList)).addView(newLog); /*String[] LogEntries = {"No log entries could be found"}; try { ((ListView) findViewById(R.id.LogList)).setAdapter(new ArrayAdapter<String>(ViewZenossEvent.this, R.layout.search_simple,LogEntries)); } catch(Exception e1) { //BugSenseHandler.log("ViewZenossEvent-LogEntries", e1); }*/ } } else { //Log.e("ViewEvent",EventObject.toString(3)); Toast.makeText(ViewZenossEvent.this, "There was an error loading the Event details", Toast.LENGTH_LONG).show(); //finish(); } } catch (Exception e) { Toast.makeText(ViewZenossEvent.this, "An error was encountered parsing the JSON. An error report has been sent.", Toast.LENGTH_LONG).show(); //BugSenseHandler.log("ViewZenossEvent", e); } } }; dialog = new ProgressDialog(this); dialog.setTitle("Contacting Zenoss"); dialog.setMessage("Please wait:\nLoading Event details...."); dialog.show(); dataPreload = new Thread() { public void run() { try { /*if(API == null) { if(settings.getBoolean("httpBasicAuth", false)) { API = new ZenossAPIv2(settings.getString("userName", ""), settings.getString("passWord", ""), settings.getString("URL", ""),settings.getString("BAUser", ""), settings.getString("BAPassword", "")); } else { API = new ZenossAPIv2(settings.getString("userName", ""), settings.getString("passWord", ""), settings.getString("URL", "")); } } EventObject = API.GetEvent(getIntent().getStringExtra("EventID"));*/ if (settings.getBoolean(ZenossAPI.PREFERENCE_IS_ZAAS, false)) { API = new ZenossAPIZaas(); } else { API = new ZenossAPICore(); } ZenossCredentials credentials = new ZenossCredentials(ViewZenossEvent.this); API.Login(credentials); EventObject = API.GetEvent(getIntent().getStringExtra("EventID")); } catch (Exception e) { firstLoadHandler.sendEmptyMessage(0); BugSenseHandler.sendExceptionMessage("ViewZenossEvent", "DataPreloadThread", e); } finally { firstLoadHandler.sendEmptyMessage(1); } } }; dataPreload.start(); }
From source file:com.liato.bankdroid.banking.banks.FirstCard.java
@Override public void update() throws BankException, LoginException, BankChoiceException { super.update(); if (username == null || password == null || username.length() == 0 || password.length() == 0) { throw new LoginException(res.getText(R.string.invalid_username_password).toString()); }/* w w w . ja v a 2 s . co m*/ urlopen = login(); try { response = urlopen.open("https://www.firstcard.se/mkol/index.jsp"); Matcher matcher = reAccounts.matcher(response); while (matcher.find()) { /* * Capture groups: * GROUP EXAMPLE DATA * 1: id kdKPq4ghlcy9wpXymSzzS46wWQcS_0OT * 2: account number 1111 3333 7777 9999 * 3: amount 9 824,08 * */ accounts.add(new Account(Html.fromHtml(matcher.group(2)).toString().trim(), Helpers.parseBalance(matcher.group(3)), matcher.group(1).trim())); balance = balance.add(Helpers.parseBalance(matcher.group(3))); } if (accounts.isEmpty()) { throw new BankException(res.getText(R.string.no_accounts_found).toString()); } } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { super.updateComplete(); } }
From source file:com.android.emailcommon.internet.Rfc822Output.java
/** * Gets both the plain text and HTML versions of the message body. *///from w w w . j a v a2 s.c om /*package*/ static String[] buildBodyText(Body body, int flags, boolean useSmartReply) { String[] messageBody = new String[] { null, null }; if (body == null) { return messageBody; } String text = body.mTextContent; boolean isReply = (flags & Message.FLAG_TYPE_REPLY) != 0; boolean isForward = (flags & Message.FLAG_TYPE_FORWARD) != 0; // For all forwards/replies, we add the intro text if (isReply || isForward) { String intro = body.mIntroText == null ? "" : body.mIntroText; text += intro; } if (useSmartReply) { // useSmartReply is set to true for use by SmartReply/SmartForward in EAS. // SmartForward doesn't put a break between the original and new text, so we add an LF if (isForward) { text += "\n"; } } else { String quotedText = body.mTextReply; // If there is no plain-text body, use de-tagified HTML as the text body if (quotedText == null && body.mHtmlReply != null) { quotedText = Html.fromHtml(body.mHtmlReply).toString(); } if (quotedText != null) { // fix CR-LF line endings to LF-only needed by EditText. Matcher matcher = PATTERN_ENDLINE_CRLF.matcher(quotedText); quotedText = matcher.replaceAll("\n"); } if (isReply) { if (quotedText != null) { Matcher matcher = PATTERN_START_OF_LINE.matcher(quotedText); text += matcher.replaceAll(">"); } } else if (isForward) { if (quotedText != null) { text += quotedText; } } } messageBody[INDEX_BODY_TEXT] = text; // Exchange 2003 doesn't seem to support multipart w/SmartReply and SmartForward, so // we'll skip this. Really, it would only matter if we could compose HTML replies if (!useSmartReply) { messageBody[INDEX_BODY_HTML] = getHtmlAlternate(body, useSmartReply); } return messageBody; }
From source file:de.appplant.cordova.emailcomposer.EmailComposerImpl.java
/** * Setter for the body./*from ww w . j a v a 2s.co m*/ * * @param body * The body of the email. * @param isHTML * Indicates the encoding (HTML or plain text). * @param draft * The intent to send. */ private void setBody(String body, Boolean isHTML, Intent draft) { if (isHTML) { draft.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(body)); draft.setType("text/html"); if (Build.VERSION.SDK_INT > 15) { draft.putExtra(Intent.EXTRA_HTML_TEXT, body); } } else { draft.putExtra(Intent.EXTRA_TEXT, body); draft.setType("text/plain"); } }
From source file:com.liato.bankdroid.banking.banks.McDonalds.java
@Override public void update() throws BankException, LoginException, BankChoiceException { super.update(); if (username == null || username.length() != 19) { throw new LoginException(res.getText(R.string.invalid_card_number).toString()); }//ww w . j a va 2 s . c o m login(); Matcher matcher = reBalance.matcher(response); if (matcher.find()) { /* * Capture groups: * GROUP EXAMPLE DATA * 1: balance 845 * */ Account account = new Account("Presentkort", Helpers.parseBalance(matcher.group(1)), "1"); balance = Helpers.parseBalance(matcher.group(1)); ArrayList<Transaction> transactions = new ArrayList<Transaction>(); matcher = reTransactions.matcher(response); while (matcher.find()) { /* * Capture groups: * GROUP EXAMPLE DATA * 1: Date 11-03-17 * 2: Location Sthlm, Sköndal * 3: Amount -144 * */ transactions.add(new Transaction("20" + matcher.group(1).trim(), Html.fromHtml(matcher.group(2)).toString().trim(), Helpers.parseBalance(matcher.group(3)))); account.setTransactions(transactions); } accounts.add(account); } if (accounts.isEmpty()) { throw new BankException(res.getText(R.string.no_accounts_found).toString()); } super.updateComplete(); }
From source file:com.liato.bankdroid.banking.banks.CSN.java
@Override public Urllib login() throws LoginException, BankException { try {/*from w w w .j a v a2 s . c o m*/ LoginPackage lp = preLogin(); response = urlopen.open(lp.getLoginTarget(), lp.getPostData()); Matcher matcher = reLoginError.matcher(response); if (matcher.find()) { throw new LoginException(Html.fromHtml(matcher.group(1)).toString().trim()); } if (!response.contains("Inloggad som")) { throw new BankException(res.getText(R.string.unable_to_login).toString()); } } catch (ClientProtocolException e) { throw new BankException("login:CPE:" + e.getCause().getMessage()); } catch (IOException e) { e.printStackTrace(); throw new BankException("login:IOE:" + e.getMessage()); } return urlopen; }