Skip to content

Instantly share code, notes, and snippets.

@FrancesTeng
Last active August 29, 2015 14:05
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 FrancesTeng/2b5cae74dc25f7775351 to your computer and use it in GitHub Desktop.
Save FrancesTeng/2b5cae74dc25f7775351 to your computer and use it in GitHub Desktop.
if (android.os.Build.VERSION.SDK_INT > 9) {
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
}
setContentView(R.layout.show_content_layout);
TextView tvTitle = (TextView) findViewById(R.id.title);
TextView tvContent = (TextView) findViewById(R.id.content);
tvTitle.setText(R.string.title_Loadjson);
try {
String ret = NetWorkOperaction.requestByHttpGet("http://tongdianer.com/out.json");
NetWorkOperaction.WeatherModel m = NetWorkOperaction.WeatherModel.parse(ret);
String content=getResources().getString(R.string.content_Loadjson);
tvContent.setText(content+m.weather1);
} catch (Exception e) {
// TODO Auto-generated catch block
Toast.makeText(this, R.string.ToastLoadjson, 1).show();
e.printStackTrace();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment