
Put your answer into Piazza.
What are the most feared words in the English language?
Put your answer into Piazza.
In the DO NOT USE!!! version of the initGame example, which call(s) take so long that they should be called outside the UI thread?
startinitializestopAsyncTask convenience class makes this easy.class DownloadTextTask extends AsyncTask<URL, Void, String> {
protected String doInBackground(URLs... urls) {
Scanner in = new Scanner(urls[0].openStream());
StringBuilder result = new StringBuilder();
while (in.hasNext()) { result.append(in.next()); result.append("\n"); }
return result;
}
protected void onPostExecute(String result) {
view.setText(result);
}
}
new DownloadTextTask().execute(new URL("http://example.com/fred.txt"));
doInBackgroundonPostExecute on the UI threadSystem.outLog.e(getClass().toString(), exception.getMessage());
Log.d for debug, Log.w for warnings etc.android.permission.INTERNET<uses-permission android:name="android.permission.INTERNET"/>


ArrayList<String> result = new ArrayList<String>();
try {
URL url = new URL(urlString);
Scanner in = new Scanner(url.openStream());
while (in.hasNextLine())
result.add(in.nextLine());
in.close();
} catch (IOException e) {
Log.e(getClass().toString(), e.getMessage());
} Place this code in your onCreate method, and then set each TextView to results.get(0), results.get(1), and so on.
Log.e call? How do you know for sure?AsyncTask to solve this problem. How did you do this?