コード例 #1
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();
    }
  }
コード例 #2
0
 private void showInfoAboutShop(Shop shop) {
   if (shop != null) {
     mEditTextName.setText(shop.getName());
     mEditTextAddress.setText(shop.getAddress());
   }
 }