@Override protected String doInBackground(String... arg0) { loadedList = context.retrieveUnitList("UnitList.CURRENCIES"); if (loadedList == null) loadedList = UnitList.CURRENCIES; Log.i("wbbug", "LoadedList: " + loadedList); int progress = 0; String num = null; Document html = null; // parse each conversion try { html = Jsoup.connect(("http://rate-exchange.appspot.com/currency?from=USD&to=AUD&q=1")) .ignoreContentType(true) .get(); num = html.text().split(" ")[3]; // removes comma num = num.substring(0, num.length() - 1); loadedList[0] = "Australian Dollar,AUD," + num; publishProgress(progress++); html = Jsoup.connect(("http://rate-exchange.appspot.com/currency?from=USD&to=XBT&q=1")) .ignoreContentType(true) .get(); num = html.text().split(" ")[3]; // removes comma num = num.substring(0, num.length() - 1); loadedList[1] = "Bitcoin,XBT," + num; publishProgress(progress++); html = Jsoup.connect(("http://rate-exchange.appspot.com/currency?from=USD&to=GBP&q=1")) .ignoreContentType(true) .get(); num = html.text().split(" ")[3]; // removes comma num = num.substring(0, num.length() - 1); loadedList[2] = "British Pound,GBP," + num; publishProgress(progress++); html = Jsoup.connect(("http://rate-exchange.appspot.com/currency?from=USD&to=CAD&q=1")) .ignoreContentType(true) .get(); num = html.text().split(" ")[3]; // removes comma num = num.substring(0, num.length() - 1); loadedList[3] = "Canadian Dollar,CAD," + num; publishProgress(progress++); html = Jsoup.connect(("http://rate-exchange.appspot.com/currency?from=USD&to=CNY&q=1")) .ignoreContentType(true) .get(); num = html.text().split(" ")[3]; // removes comma num = num.substring(0, num.length() - 1); loadedList[4] = "Chinese Yuan Renminbi,CNY," + num; publishProgress(progress++); html = Jsoup.connect(("http://rate-exchange.appspot.com/currency?from=USD&to=EUR&q=1")) .ignoreContentType(true) .get(); num = html.text().split(" ")[3]; // removes comma num = num.substring(0, num.length() - 1); loadedList[5] = "Euro,EUR," + num; publishProgress(progress++); html = Jsoup.connect(("http://rate-exchange.appspot.com/currency?from=USD&to=INR&q=1")) .ignoreContentType(true) .get(); num = html.text().split(" ")[3]; // removes comma num = num.substring(0, num.length() - 1); loadedList[6] = "Indian Rupee,INR," + num; publishProgress(progress++); html = Jsoup.connect(("http://rate-exchange.appspot.com/currency?from=USD&to=MYR&q=1")) .ignoreContentType(true) .get(); num = html.text().split(" ")[3]; // removes comma num = num.substring(0, num.length() - 1); loadedList[7] = "Malaysian Ringgit,MYR," + num; publishProgress(progress++); html = Jsoup.connect(("http://rate-exchange.appspot.com/currency?from=USD&to=MXN&q=1")) .ignoreContentType(true) .get(); num = html.text().split(" ")[3]; // removes comma num = num.substring(0, num.length() - 1); loadedList[8] = "Mexican Peso,MXN," + num; publishProgress(progress++); html = Jsoup.connect(("http://rate-exchange.appspot.com/currency?from=USD&to=AED&q=1")) .ignoreContentType(true) .get(); num = html.text().split(" ")[3]; // removes comma num = num.substring(0, num.length() - 1); loadedList[9] = "U.A.E. Emirati Dirham,AED," + num; publishProgress(progress++); num = "1.0"; loadedList[10] = "United States Dollar,USD," + num; publishProgress(progress++); // print results for (int i = 0; i < loadedList.length; i++) Log.i("wbbug", loadedList[i]); // load new list in main activity if (loadedList != null) { MainActivity.storeUnitList(context, "UnitList.CURRENCIES", loadedList); UnitList.CURRENCIES = loadedList; MainActivity.selectedList = loadedList; } } catch (Exception e) { reportError(e); return null; } return "notnull"; }