Created
November 19, 2012 20:31
-
-
Save michiakig/4113689 to your computer and use it in GitHub Desktop.
CheckThread blog post HackerNewsActivityV3LessBuggy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new Thread() { | |
@ThreadConfined("other") | |
public void run() | |
{ | |
try | |
{ | |
String feed = IO.getHttp(kHackerNewsRssUrl); | |
final List<String> titles = HackerNewsRSSParser.parseTitles(feed); | |
HackerNewsActivityV3LessBuggy.this.runOnUiThread(new Runnable() | |
{ | |
@ThreadConfined(ThreadName.MAIN) | |
public void run() | |
{ | |
for (String t : titles) | |
{ | |
TextView textView = new TextView(HackerNewsActivityV3LessBuggy.this); | |
textView.setText(t); | |
linearLayout.addView(textView); | |
} | |
} | |
}); | |
} | |
catch (IOException e) | |
{ | |
e.printStackTrace(); | |
} | |
} | |
}.start(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment