Skip to content

Instantly share code, notes, and snippets.

@FrancesTeng
Created August 27, 2014 09:55
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/07c7829d187fd0b3f24f to your computer and use it in GitHub Desktop.
Save FrancesTeng/07c7829d187fd0b3f24f to your computer and use it in GitHub Desktop.
@@ -0,0 +1,18 @@
+ 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