private void loadInstanceState(Bundle savedInstanceState) { long idShop = getIdShop(); if (idShop > 0) mShop = dbHelper.getShop(getIdShop()); else { mShop = new Shop(); } showInfoAboutShop(mShop); }
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(); } }