Example usage for android.widget ArrayAdapter setDropDownViewResource

List of usage examples for android.widget ArrayAdapter setDropDownViewResource

Introduction

In this page you can find the example usage for android.widget ArrayAdapter setDropDownViewResource.

Prototype

public void setDropDownViewResource(@LayoutRes int resource) 

Source Link

Document

Sets the layout resource to create the drop down views.

Usage

From source file:com.micabytes.app.BaseFragment.java

@NonNull
protected Spinner setSpinner(int resId, int arrId, int spIt, int spDd) throws UIObjectNotFoundException {
    View root = getView();/*www  .  ja  v a 2  s  .  c om*/
    if (root == null)
        throw new UIObjectNotFoundException(COULD_NOT_FIND_THE_ROOT_VIEW);
    Spinner spinner = (Spinner) root.findViewById(resId);
    if (spinner == null)
        throw new UIObjectNotFoundException(COULD_NOT_FIND_RES_ID + resId + IN_FIND_VIEW_BY_ID);
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getActivity().getApplicationContext(),
            arrId, spIt);
    adapter.setDropDownViewResource(spDd);
    spinner.setAdapter(adapter);
    return spinner;
}

From source file:com.hilllander.naunginlecalendar.view.activity.MainActivity.java

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    View tbShadow = findViewById(R.id.home_toolbar_shadow);
    Util.hideToolBarShadowForLollipop(this, toolbar, tbShadow);
    mainLayout = (LinearLayout) findViewById(R.id.main_layout);
    Util.setStatusBarPaddingForKitkat(this, mainLayout);
    setSupportActionBar(toolbar);// ww w.j  a  va  2s  .com
    Util.setSystemUiVisibilityForKitkat(this);
    getSupportActionBar().setDisplayShowTitleEnabled(false);
    spinner = (Spinner) findViewById(R.id.spinner);
    ArrayAdapter<CharSequence> arrayAdapter = ArrayAdapter.createFromResource(this, R.array.spinner_item,
            android.R.layout.simple_spinner_item);
    arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinner.setAdapter(arrayAdapter);
    spinner.setOnItemSelectedListener(new SpinnerListener());
    GregorianCalendar today = new GregorianCalendar();
    setCurrentDate(today.get(Calendar.YEAR), today.get(Calendar.MONTH), today.get(Calendar.DAY_OF_MONTH));
    detecter = new SimpleGestureFilter(this, this);

}

From source file:com.mifos.mifosxdroid.online.SavingsAccountFragment.java

private void inflateinterestCalculationDaysInYearType() {

    final ArrayList<String> InterestCalculationDaysInYearTypeNames = filterListObject(
            savingproductstemplate.getInterestCalculationDaysInYearTypeOptions());

    final ArrayAdapter<String> interestCalculationDaysInYearTypeAdapter = new ArrayAdapter<>(getActivity(),
            layout.simple_spinner_item, InterestCalculationDaysInYearTypeNames);
    interestCalculationDaysInYearTypeAdapter.setDropDownViewResource(layout.simple_spinner_dropdown_item);
    sp_days_in_year.setAdapter(interestCalculationDaysInYearTypeAdapter);
    sp_days_in_year.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        @Override// ww w.j  a  v a2s . c o m
        public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
            interestCalculationDaysInYearTypeId = savingproductstemplate
                    .getInterestCalculationDaysInYearTypeOptions().get(i).getId();
            Log.d("interestCalculationD" + InterestCalculationDaysInYearTypeNames.get(i),
                    String.valueOf(interestCalculationDaysInYearTypeId));
            if (interestCalculationDaysInYearTypeId != -1) {

            } else {

                Toast.makeText(getActivity(), getString(R.string.interestCalculationDaysInYearTypeAdapterId),
                        Toast.LENGTH_SHORT).show();

            }

        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {

        }
    });

}

From source file:com.hardcopy.retrowatch.FiltersFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Logs.d(TAG, "# FiltersFragment - onCreateView()");

    View rootView = inflater.inflate(R.layout.fragment_filters, container, false);

    mListFilter = (ListView) rootView.findViewById(R.id.list_filters);
    if (mFiltersAdapter == null)
        mFiltersAdapter = new FiltersAdapter(mContext, R.layout.list_filters, null, this);
    mListFilter.setAdapter(mFiltersAdapter);
    if (mFiltersCache != null) {
        mFiltersAdapter.addFilterAll(mFiltersCache);
        mFiltersAdapter.notifyDataSetChanged();
        mFiltersCache = null;//from  w  ww . ja  v a2  s . c o  m
    }

    // Filter object type
    mSpinnerFilterType = (Spinner) rootView.findViewById(R.id.spinner_type);
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(mContext, R.array.filter_type_array,
            R.layout.spinner_simple_item);
    adapter.setDropDownViewResource(R.layout.spinner_dropdown_simple_item);
    mSpinnerFilterType.setPrompt(mContext.getString(R.string.filter_object_type));
    mSpinnerFilterType.setAdapter(adapter);
    mSpinnerFilterType.setOnItemSelectedListener(new OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            mCurrentFilterObject.mType = position;
        }

        @Override
        public void onNothingSelected(AdapterView<?> arg0) {
        }
    });

    // Compare type
    mSpinnerCompareType = (Spinner) rootView.findViewById(R.id.spinner_compare_type);
    ArrayAdapter<CharSequence> adapter2 = ArrayAdapter.createFromResource(mContext,
            R.array.filter_matching_type_array, R.layout.spinner_simple_item);
    adapter2.setDropDownViewResource(R.layout.spinner_dropdown_simple_item);
    mSpinnerCompareType.setPrompt(mContext.getString(R.string.filter_compare_type));
    mSpinnerCompareType.setAdapter(adapter2);
    mSpinnerCompareType.setOnItemSelectedListener(new OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            mCurrentFilterObject.mCompareType = position;
        }

        @Override
        public void onNothingSelected(AdapterView<?> arg0) {
        }
    });

    // Replace method
    mSpinnerReplaceType = (Spinner) rootView.findViewById(R.id.spinner_replace_type);
    ArrayAdapter<CharSequence> adapter3 = ArrayAdapter.createFromResource(mContext,
            R.array.filter_replace_type_array, R.layout.spinner_simple_item);
    adapter3.setDropDownViewResource(R.layout.spinner_dropdown_simple_item);
    mSpinnerReplaceType.setPrompt(mContext.getString(R.string.filter_replace_type));
    mSpinnerReplaceType.setAdapter(adapter3);
    mSpinnerReplaceType.setOnItemSelectedListener(new OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            mCurrentFilterObject.mReplaceType = position;
        }

        @Override
        public void onNothingSelected(AdapterView<?> arg0) {
        }
    });

    // Icon
    mSpinnerIconType = (Spinner) rootView.findViewById(R.id.spinner_icon_type);
    ArrayAdapter<CharSequence> adapter4 = ArrayAdapter.createFromResource(mContext,
            R.array.filter_icon_type_array, R.layout.spinner_simple_item2);
    adapter4.setDropDownViewResource(R.layout.spinner_dropdown_simple_item);
    mSpinnerIconType.setPrompt(mContext.getString(R.string.filter_icon));
    mSpinnerIconType.setAdapter(adapter4);
    mSpinnerIconType.setOnItemSelectedListener(new OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            mCurrentFilterObject.mIconType = position - 1;
        }

        @Override
        public void onNothingSelected(AdapterView<?> arg0) {
        }
    });

    mEditOrigin = (EditText) rootView.findViewById(R.id.edit_origin);
    mEditReplace = (EditText) rootView.findViewById(R.id.edit_replace);

    mButtonDelete = (Button) rootView.findViewById(R.id.btn_delete);
    mButtonDelete.setOnClickListener(this);
    mButtonAdd = (Button) rootView.findViewById(R.id.btn_add);
    mButtonAdd.setOnClickListener(this);
    mButtonNew = (Button) rootView.findViewById(R.id.btn_new);
    mButtonNew.setOnClickListener(this);

    // Make new filter object and set data on widget
    makeDefaultFilterObject();

    return rootView;
}

From source file:com.facebook.android.MainPage.java

/** Called when the activity is first created. */
@Override//  w  w w . ja  v  a  2  s.c  o  m
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (APP_ID == null) {
        Util.showAlert(this, "Warning",
                "Facebook Applicaton ID must be " + "specified before running this example: see Example.java");
    }

    setContentView(R.layout.main);
    mMovieNameInput = (EditText) findViewById(R.id.title);
    mMediaSpinner = (Spinner) findViewById(R.id.media);
    mSearchButton = (Button) findViewById(R.id.search);
    mFacebook = new Facebook(APP_ID);
    mAsyncRunner = new AsyncFacebookRunner(mFacebook);

    SessionStore.restore(mFacebook, this);
    SessionEvents.addAuthListener(new SampleAuthListener());
    SessionEvents.addLogoutListener(new SampleLogoutListener());
    // set up the Spinner for the media list selection
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.media_list,
            android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    mMediaSpinner.setAdapter(adapter);

    //for search button         
    final Context context = this;
    mSearchButton.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            String servletURL;
            String movieName = mMovieNameInput.getText().toString();
            // check the input text of movie, if the text is empty give user alert
            movieName = movieName.trim();
            if (movieName.length() == 0) {
                Toast toast = Toast.makeText(context, "Please enter a movie name", Toast.LENGTH_LONG);
                toast.setGravity(Gravity.TOP | Gravity.CENTER, 0, 70);
                toast.show();
            }
            // if movie name is not empty
            else {
                // remove any extra whitespace
                movieName = movieName.replaceAll("\\s+", "+");
                String mediaList = mMediaSpinner.getSelectedItem().toString();
                if (mediaList.equals("Feature Film")) {
                    mediaList = "feature";
                }
                mediaList = mediaList.replaceAll("\\s+", "+");
                // construct the query string
                // construct the final URL to Servlet
                //String servletString = "?" + "title=" + movieName + "&" + "title_type=" + mediaList;
                //servletURL = "http://cs-server.usc.edu:10854/examples/servlet/Amovie"
                //+ servletString;
                //String servletString = "?" + "title=" + movieName + "&" + "media=" + mediaList;
                //servletURL = "http://cs-server.usc.edu:34404/examples/servlet/HelloWorldExample?title=" + movieName + "&" + "media=" + mediaList;
                //+ servletString;
                servletURL = "http://cs-server.usc.edu:10854/examples/servlet/Amovie?title=" + movieName + "&"
                        + "title_type=" + mediaList;
                BufferedReader in = null;
                try {
                    // REFERENCE: this part of code is modified from:
                    // "Example of HTTP GET Request using HttpClient in Android"
                    // http://w3mentor.com/learn/java/android-development/android-http-services/example-of-http-get-request-using-httpclient-in-android/
                    // get response (JSON string) from Servlet 
                    HttpClient client = new DefaultHttpClient();
                    HttpGet request = new HttpGet();
                    request.setURI(new URI(servletURL));
                    HttpResponse response = client.execute(request);
                    in = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
                    StringBuffer sb = new StringBuffer("");
                    String line = "";
                    String NL = System.getProperty("line.separator");
                    while ((line = in.readLine()) != null) {
                        sb.append(line + NL);
                    }
                    in.close();
                    String page = sb.toString();
                    //test for JSON string
                    /*LinearLayout lView = new LinearLayout(context);
                    TextView myText = new TextView(context);
                    myText.setText(page);
                    lView.addView(myText);
                    setContentView(lView);*/

                    // convert the JSON string to real JSON and get out the movie JSON array
                    // to check if there is any movie data
                    JSONObject finalJson;
                    JSONObject movieJson;
                    JSONArray movieJsonArray;
                    finalJson = new JSONObject(page);
                    movieJson = finalJson.getJSONObject("results");
                    //System.out.println(movieJson);
                    movieJsonArray = movieJson.getJSONArray("result");

                    // if the response contains some movie data
                    if (movieJsonArray.length() != 0) {

                        // start the ListView activity, and pass the JSON string to it
                        Intent intent = new Intent(context, MovieListActivity.class);
                        intent.putExtra("finalJson", page);
                        startActivity(intent);
                    }
                    // if the response does not contain any movie data,
                    // show user that there is no result for this search
                    else {
                        Toast toast = Toast.makeText(getBaseContext(), "No movie found for this search",
                                Toast.LENGTH_LONG);
                        toast.setGravity(Gravity.CENTER, 0, 0);
                        toast.show();
                    }
                } catch (URISyntaxException e) {
                    e.printStackTrace();
                } catch (ClientProtocolException e) {
                    e.printStackTrace();
                } catch (JSONException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                } finally {
                    if (in != null) {
                        try {
                            in.close();
                        } catch (IOException e) {
                            e.printStackTrace();
                        }
                    }
                }
            }
        }
    });
}

From source file:com.microsoft.o365_android_onenote_rest.SnippetDetailFragment.java

private void populateSpinner(String[] strings) {
    ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<>(getActivity(), simple_spinner_item, strings);
    spinnerArrayAdapter.setDropDownViewResource(simple_spinner_dropdown_item);
    mSpinner.setAdapter(spinnerArrayAdapter);
}

From source file:com.adithya321.sharesanalysis.fragments.PurchaseShareFragment.java

private void setRecyclerViewAdapter() {
    sharesList = databaseHandler.getShares();
    purchaseList = databaseHandler.getPurchases();

    if (sharesList.size() < 1) {
        emptyTV.setVisibility(View.VISIBLE);
        arrow.setVisibility(View.VISIBLE);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            if (getResources().getConfiguration().orientation == 1) {
                arrow.setBackground(getResources().getDrawable(R.drawable.curved_line_vertical));
            } else {
                arrow.setBackground((getResources().getDrawable(R.drawable.curved_line_horizontal)));
            }//w w w  .  j  av  a  2s  . c om
        }
    } else {
        emptyTV.setVisibility(View.GONE);
        arrow.setVisibility(View.GONE);
    }

    PurchaseShareAdapter purchaseAdapter = new PurchaseShareAdapter(getContext(), purchaseList);
    purchaseAdapter.setOnItemClickListener(new PurchaseShareAdapter.OnItemClickListener() {
        @Override
        public void onItemClick(View itemView, int position) {
            final Purchase purchase = purchaseList.get(position);

            final Dialog dialog = new Dialog(getContext());
            dialog.setTitle("Edit Share Purchase");
            dialog.setContentView(R.layout.dialog_add_share_purchase);
            dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT,
                    WindowManager.LayoutParams.WRAP_CONTENT);
            dialog.show();

            RadioButton newRB = (RadioButton) dialog.findViewById(R.id.radioBtn_new);
            RadioButton existingRB = (RadioButton) dialog.findViewById(R.id.radioBtn_existing);
            AutoCompleteTextView name = (AutoCompleteTextView) dialog.findViewById(R.id.share_name);
            newRB.setVisibility(View.GONE);
            existingRB.setChecked(true);
            name.setVisibility(View.GONE);

            final Spinner spinner = (Spinner) dialog.findViewById(R.id.existing_spinner);
            ArrayList<String> shares = new ArrayList<>();
            int pos = 0;
            for (int i = 0; i < sharesList.size(); i++) {
                shares.add(sharesList.get(i).getName());
                if (sharesList.get(i).getName().equals(purchase.getName()))
                    pos = i;
            }
            ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<>(getContext(),
                    android.R.layout.simple_spinner_item, shares);
            spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
            spinner.setAdapter(spinnerAdapter);
            spinner.setSelection(pos);
            spinner.setVisibility(View.VISIBLE);

            final EditText quantity = (EditText) dialog.findViewById(R.id.no_of_shares);
            final EditText price = (EditText) dialog.findViewById(R.id.buying_price);
            quantity.setText(String.valueOf(purchase.getQuantity()));
            price.setText(String.valueOf(purchase.getPrice()));

            Calendar calendar = Calendar.getInstance();
            calendar.setTime(purchase.getDate());
            year_start = calendar.get(Calendar.YEAR);
            month_start = calendar.get(Calendar.MONTH) + 1;
            day_start = calendar.get(Calendar.DAY_OF_MONTH);
            final Button selectDate = (Button) dialog.findViewById(R.id.select_date);
            selectDate.setText(new StringBuilder().append(day_start).append("/").append(month_start).append("/")
                    .append(year_start));
            selectDate.setOnClickListener(PurchaseShareFragment.this);

            Button addPurchaseBtn = (Button) dialog.findViewById(R.id.add_purchase_btn);
            addPurchaseBtn.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Purchase p = new Purchase();
                    p.setId(purchase.getId());

                    String stringStartDate = year_start + " " + month_start + " " + day_start;
                    DateFormat format = new SimpleDateFormat("yyyy MM dd", Locale.ENGLISH);
                    try {
                        Date date = format.parse(stringStartDate);
                        p.setDate(date);
                    } catch (Exception e) {
                        Toast.makeText(getActivity(), "Invalid Date", Toast.LENGTH_SHORT).show();
                        return;
                    }

                    try {
                        p.setQuantity(Integer.parseInt(quantity.getText().toString()));
                    } catch (Exception e) {
                        Toast.makeText(getActivity(), "Invalid Number of Shares", Toast.LENGTH_SHORT).show();
                        return;
                    }

                    try {
                        p.setPrice(Double.parseDouble(price.getText().toString()));
                    } catch (Exception e) {
                        Toast.makeText(getActivity(), "Invalid Buying Price", Toast.LENGTH_SHORT).show();
                        return;
                    }

                    p.setType("buy");
                    p.setName(spinner.getSelectedItem().toString());
                    databaseHandler.updatePurchase(p);
                    setRecyclerViewAdapter();
                    dialog.dismiss();
                }
            });
        }
    });
    sharePurchasesRecyclerView.setHasFixedSize(true);
    sharePurchasesRecyclerView.setAdapter(purchaseAdapter);
    sharePurchasesRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
}

From source file:com.orpheusdroid.screenrecorder.folderpicker.FolderChooser.java

private void initView(View view) {
    ImageButton up = view.findViewById(R.id.nav_up);
    ImageButton createDir = view.findViewById(R.id.create_dir);
    tv_currentDir = view.findViewById(R.id.tv_selected_dir);
    rv = view.findViewById(R.id.rv);/*from w ww .j  av a 2  s .c  o  m*/
    tv_empty = view.findViewById(R.id.tv_empty);
    spinner = view.findViewById(R.id.storageSpinner);
    up.setOnClickListener(this);
    createDir.setOnClickListener(this);
    ArrayList<String> StorageStrings = new ArrayList<>();
    for (Storages storage : storages) {
        String storageType = storage.getType() == Storages.StorageType.Internal ? "Internal Storage"
                : "Removable Storage";
        StorageStrings.add(storageType);
    }
    ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(getContext(),
            android.R.layout.simple_spinner_item, StorageStrings);

    // Drop down layout style - list view with radio button
    dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    // attaching data adapter to spinner
    spinner.setAdapter(dataAdapter);
    spinner.setOnItemSelectedListener(this);
}

From source file:com.mifos.mifosxdroid.online.loanrepayment.LoanRepaymentFragment.java

@Override
public void showLoanRepayTemplate(final LoanRepaymentTemplate loanRepaymentTemplate) {
    /* Activity is null - Fragment has been detached; no need to do anything. */
    if (getActivity() == null)
        return;// www .j av  a  2s .  c o  m

    if (loanRepaymentTemplate != null) {
        tv_amountDue.setText(String.valueOf(loanRepaymentTemplate.getAmount()));
        inflateRepaymentDate();
        List<String> listOfPaymentTypes = Utils
                .getPaymentTypeOptions(loanRepaymentTemplate.getPaymentTypeOptions());

        ArrayAdapter<String> paymentTypeAdapter = new ArrayAdapter<>(getActivity(), layout.simple_spinner_item,
                listOfPaymentTypes);

        paymentTypeAdapter.setDropDownViewResource(layout.simple_spinner_dropdown_item);
        sp_paymentType.setAdapter(paymentTypeAdapter);
        sp_paymentType.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                paymentTypeOptionId = loanRepaymentTemplate.getPaymentTypeOptions().get(position).getId();
            }

            @Override
            public void onNothingSelected(AdapterView<?> parent) {

            }
        });

        et_amount.setText(String.valueOf(
                loanRepaymentTemplate.getPrincipalPortion() + loanRepaymentTemplate.getInterestPortion()));
        et_additionalPayment.setText("0.0");
        et_fees.setText(String.valueOf(loanRepaymentTemplate.getFeeChargesPortion()));

    }
}

From source file:eu.power_switch.gui.fragment.configure_gateway.ConfigureGatewayDialogPage1Fragment.java

@Nullable
@Override/*from  ww w .  ja v  a2 s.c o m*/
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {
    rootView = inflater.inflate(R.layout.dialog_fragment_configure_gateway_page_1, container, false);

    TextWatcher textWatcher = new TextWatcher() {
        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void afterTextChanged(Editable s) {
            checkSetupValidity();
            sendAddressChangedBroadcast(getActivity());
        }
    };
    floatingName = (TextInputLayout) rootView.findViewById(R.id.gateway_name_text_input_layout);
    name = (EditText) rootView.findViewById(R.id.txt_edit_gateway_name);
    name.addTextChangedListener(textWatcher);

    model = (Spinner) rootView.findViewById(R.id.spinner_gateway_type);
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getActivity(), R.array.gateway_array,
            android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line);
    model.setAdapter(adapter);
    SpinnerInteractionListener spinnerInteractionListener = new SpinnerInteractionListener() {
        @Override
        public void onItemSelectedByUser(AdapterView<?> parent, View view, int pos, long id) {
            sendAddressChangedBroadcast(getActivity());
        }
    };
    model.setOnTouchListener(spinnerInteractionListener);
    model.setOnItemSelectedListener(spinnerInteractionListener);

    floatingLocalAddress = (TextInputLayout) rootView
            .findViewById(R.id.gateway_local_address_text_input_layout);
    localAddress = (EditText) rootView.findViewById(R.id.txt_edit_gateway_local_address);
    localAddress.addTextChangedListener(textWatcher);

    floatingLocalPort = (TextInputLayout) rootView.findViewById(R.id.gateway_local_port_text_input_layout);
    localPort = (EditText) rootView.findViewById(R.id.txt_edit_gateway_local_port);
    localPort.addTextChangedListener(textWatcher);

    floatingWanAddress = (TextInputLayout) rootView.findViewById(R.id.gateway_wan_address_text_input_layout);
    wanAddress = (EditText) rootView.findViewById(R.id.txt_edit_gateway_wan_address);
    wanAddress.addTextChangedListener(textWatcher);

    floatingWanPort = (TextInputLayout) rootView.findViewById(R.id.gateway_wan_port_text_input_layout);
    wanPort = (EditText) rootView.findViewById(R.id.txt_edit_gateway_wan_port);
    wanPort.addTextChangedListener(textWatcher);

    Bundle args = getArguments();
    if (args != null && args.containsKey(ConfigureGatewayDialog.GATEWAY_ID_KEY)) {
        gatewayId = args.getLong(ConfigureGatewayDialog.GATEWAY_ID_KEY);
        initializeGatewayData(gatewayId);
    }
    checkSetupValidity();

    return rootView;
}