public int getPosition() { String productText; int pos = 0; for (int i = 0; i < adapter.getCount(); i++) { productText = adapter.getItem(i).getProductName(); if (Util.getChannelProductName(getActivity()) .replace(" ", "") .equals(productText.replace(" ", ""))) { pos = i; break; } } return pos; }
@Override public void onClick(View v) { switch (v.getId()) { case R.id.config_product_done: Util.setChannelAreaCode(getActivity(), selectedAreaCode); Util.setChannelAreaName(getActivity(), selectedAreaName); if (isNoSelect) { selectedProductCode = adapter.getItem(0).getProductCode(); selectedProductName = adapter.getItem(0).getProductName(); } Util.setChannelProductCode(getActivity(), selectedProductCode); Util.setChannelProductName(getActivity(), selectedProductName); // 지역, 상품정보를 refresh Fragment fg = ((MainActivity) getActivity()).getFragmentConfig(); if (fg != null) { ((ConfigMain) fg).refreshAreaProduct(); } getActivity().onBackPressed(); break; } }