private void init() { ((TextView) findViewById(R.id.tvTitle)).setText(R.string.goodsmis); findViewById(R.id.tvBack).setOnClickListener(this); // 返回 List<MixtureInfo> mixInfos = MixInfoProvider.getInstance().getMixtureList(); mixtureAdapter = new MixtureAdapter(this, mixInfos); mixGridView = (GridView) findViewById(R.id.mix_grid); mixGridView.setAdapter(mixtureAdapter); mixGridView.setOnItemClickListener( new OnItemClickListener() { public void onItemClick(AdapterView<?> arg0, View v, int position, long id) { if (flag) { // 去合成 Intent intent = new Intent(MixGridActivity.this, MixActivity.class); intent.putExtra("position", position); startActivity(intent); } else { Toast.makeText( MixGridActivity.this, MixGridActivity.this .getResources() .getString(R.string.package_no_obtain_material), Toast.LENGTH_SHORT) .show(); } } }); btnFreeBean = (ImageView) findViewById(R.id.btnFreeBean); btnFreeBean.setOnClickListener(this); handler.sendEmptyMessageDelayed(START_ANIM, 300); }
private void initData() { pos = getIntent().getExtras().getInt("position"); mixInfos = MixInfoProvider.getInstance().getMixtureInfo(); mixInfo = mixInfos[pos]; consumeList = mixInfo.consumeList; }