@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.listview); cityListView = (ListView) findViewById(R.id.city_list); setTitle("选择城市"); String webSite = "https://api.douban.com/v2/loc/list"; if (progressDialog == null) { progressDialog = new ProgressDialog(this); progressDialog.setMessage("加载中"); progressDialog.setCanceledOnTouchOutside(false); progressDialog.show(); } HttpUtil.sendHttpRequest( webSite, new HttpCallbackListener() { @Override public void onFinish(String response) { progressDialog.dismiss(); parseJSONWithJSONObjects(response); } @Override public void onError(Exception e) {} }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); imageView = (ImageView) findViewById(R.id.image); title = (TextView) findViewById(R.id.title); participant = (TextView) findViewById(R.id.participant); wish = (TextView) findViewById(R.id.wish); content = (TextView) findViewById(R.id.content); map = (Button) findViewById(R.id.map); look = (Button) findViewById(R.id.look); if (progressDialog == null) { progressDialog = new ProgressDialog(this); progressDialog.setMessage("加载中"); progressDialog.setCanceledOnTouchOutside(false); progressDialog.show(); } Intent intent = getIntent(); String eventId = intent.getStringExtra("eventId"); String website = "https://api.douban.com/v2/event/" + eventId; HttpUtil.sendHttpRequest( website, new HttpCallbackListener() { @Override public void onFinish(String response) { Utility.handleEvent(MainActivity.this, response); runOnUiThread( new Runnable() { @Override public void run() { showInfo(); progressDialog.dismiss(); } }); } @Override public void onError(Exception e) {} }); setTitle("活动详情"); }