Skip to content

Instantly share code, notes, and snippets.

@michiakig
Created November 19, 2012 20:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michiakig/4113689 to your computer and use it in GitHub Desktop.
Save michiakig/4113689 to your computer and use it in GitHub Desktop.
CheckThread blog post HackerNewsActivityV3LessBuggy.java
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