示例#1
0
 private void loadInstanceState(Bundle savedInstanceState) {
   long idShop = getIdShop();
   if (idShop > 0) mShop = dbHelper.getShop(getIdShop());
   else {
     mShop = new Shop();
   }
   showInfoAboutShop(mShop);
 }
示例#2
0
  public void goSaveInfoShop() {
    if (mShop == null) return;
    String name = mEditTextName.getText().toString();
    if (!TextUtils.isEmpty(name)) {
      mShop.setAddress(mEditTextAddress.getText().toString());
      mShop.setName(name);
      dbHelper.addShop(mShop);
      Toast.makeText(getActivity(), "Save successful!", Toast.LENGTH_SHORT).show();

      if (ShopDetailActivity.class.isInstance(getActivity())) {
        ((ShopDetailActivity) getActivity()).finishActivity(true);
      }
    } else {
      // TODO: доработать обработку ошибок и поведение приложения при этом
      mEditTextName.requestFocus();
    }
  }