json相关事务的执行情况
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
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
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