@Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == 10001) { product.setPanDianNum(Integer.parseInt(pro_pandiannum.getText().toString())); Intent intent = new Intent(); intent.putExtra("product", product); setResult(RESULT_OK, intent); this.finish(); } else if (item.getItemId() == android.R.id.home) { this.finish(); return false; } return super.onOptionsItemSelected(item); }
@Override protected void onCreate(Bundle savedInstanceState) { setTheme(R.style.StyledIndicators); super.onCreate(savedInstanceState); setContentView(R.layout.pandian_product_edit); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle("编辑商品数量"); product = (PanDianProduct) getIntent().getSerializableExtra("product"); // entity = (ProductEntity) getIntent().getSerializableExtra("entity"); pro_name = (TextView) findViewById(R.id.pro_name); pro_kucunnum = (TextView) findViewById(R.id.pro_kucunnum); pro_price = (TextView) findViewById(R.id.pro_price); pro_amount = (TextView) findViewById(R.id.pro_amount); pro_guige = (TextView) findViewById(R.id.pro_guige); pro_xinghao = (TextView) findViewById(R.id.pro_xinghao); pro_changdi = (TextView) findViewById(R.id.pro_changdi); pro_pandiannum = (EditText) findViewById(R.id.pro_pandiannum); pro_name.setText(product.getFullName()); pro_kucunnum.setText(product.getNum() + ""); pro_price.setText(product.getPrice()); pro_amount.setText(product.getAmount()); pro_guige.setText(product.getStandard()); pro_xinghao.setText(product.getType()); pro_changdi.setText(product.getArea()); pro_pandiannum.setText(product.getPanDianNum() + ""); pro_pandiannum.setOnClickListener(this); pro_delete = (Button) findViewById(R.id.pro_delete); pro_delete.setOnClickListener(this); }