@Override public void onClick(View v) { switch (v.getId()) { case R.id.address_tv: break; case R.id.priceinfo_tv: break; case R.id.bedinfo_tv: break; case R.id.infolong_tv: break; case R.id.service_tv: break; case R.id.contactway_tv: break; case R.id.common_title_left: finish(); break; case R.id.common_title_right: // 收藏或者已收藏 if (store) { // 删除数据库保存 ZhaopinDBHelper.getInstance(context).deleteZhaopin(zhaopindetailbean); handler.sendEmptyMessage(UNCHOOSE); } else { // 插入数据库 ZhaopinDBHelper.getInstance(context).addZhaopin(zhaopindetailbean); handler.sendEmptyMessage(CHOOSE); } break; default: break; } }
public void init() { context = ZhaopinDetailActivity.this; title_left = (ImageView) findViewById(R.id.common_title_left); title_right = (ImageView) findViewById(R.id.common_title_right); title_mid = (TextView) findViewById(R.id.common_title_mid); title_left.setOnClickListener(this); title_right.setOnClickListener(this); wv = (WebView) findViewById(R.id.wv); progress = (ProgressBar) findViewById(R.id.progress); ZhaopinDetailBean temp = ZhaopinDBHelper.getInstance(context).getZhaopin(zhaopinbasebean.getUrl()); if (temp == null) { store = false; handler.sendEmptyMessage(UNCHOOSE); } else { store = true; handler.sendEmptyMessage(CHOOSE); zhaopindetailbean = temp; } if (store) { wv.loadData(zhaopindetailbean.getContent(), "text/html", "UTF-8"); } else { getData(zhaopinbasebean); } }