Example usage for android.widget Spinner setSelection

List of usage examples for android.widget Spinner setSelection

Introduction

In this page you can find the example usage for android.widget Spinner setSelection.

Prototype

@Override
    public void setSelection(int position) 

Source Link

Usage

From source file:com.starwood.anglerslong.LicenseAddActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Bundle bundle = this.getIntent().getExtras();

    setContentView(R.layout.license_add);

    Spinner s = (Spinner) findViewById(R.id.spinner);
    @SuppressWarnings("unchecked")
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item,
            getResources().getStringArray(R.array.state_array));
    s.setAdapter(adapter);/* w  w  w.  j  a  va2  s  .  co  m*/

    s.setOnItemSelectedListener(this);

    isPopulated = bundle.getBoolean("isPopulated");
    isArrayEmpty = bundle.getBoolean("isArrayEmpty");
    if (bundle.containsKey("isEdit"))
        isEdit = bundle.getBoolean("isEdit");
    if (bundle.containsKey("currentItemID"))
        currentItemID = bundle.getInt("currentItemID");

    getSupportActionBar().setTitle(bundle.getString("title"));
    //        getSupportActionBar().setSubtitle(bundle.getString("subtitle"));

    if (isEdit) {
        try {
            JsonStorage jsonStorage = new JsonStorage(getApplicationContext());
            String json = jsonStorage.readProfileJSON(); // Store the JSON into string
            JSONObject j = new JSONObject(json);
            JSONObject outer = j.getJSONObject("outermost"); // Outermost JSON
            JSONArray innerArray = outer.getJSONArray("license");
            JSONObject inner = innerArray.getJSONObject(currentItemID);

            Spinner editSpinner = (Spinner) findViewById(R.id.spinner);
            editSpinner.setSelection(inner.getInt("state") + 1); // Set spinner

            EditText edit = (EditText) findViewById(R.id.license_name);
            edit.setText(inner.getString("name"));
            edit = (EditText) findViewById(R.id.license_number);
            edit.setText(inner.getString("number"));
            edit = (EditText) findViewById(R.id.license_type);
            edit.setText(inner.getString("type"));
            edit = (EditText) findViewById(R.id.license_issue_date);
            edit.setText(inner.getString("issue_date"));
            edit = (EditText) findViewById(R.id.license_expiration_date);
            edit.setText(inner.getString("exp_date"));
            edit = (EditText) findViewById(R.id.license_birthday);
            edit.setText(inner.getString("birthday"));
            edit = (EditText) findViewById(R.id.license_huntered);
            edit.setText(inner.getString("huntered"));

        } catch (JSONException | IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}

From source file:com.esri.arcgisruntime.sample.hillshaderenderer.ParametersDialogFragment.java

/**
 * Builds a parameter dialog box with values pulled through from MainActivity.
 * @param savedInstanceState bundle holding previous activity's saved state
 * @return create parameter dialog box//from  w  w  w  .jav a2 s.  c o m
 */
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    Bundle hillshadeParameters = getArguments();
    if (hillshadeParameters != null) {
        mAltitude = hillshadeParameters.getInt("altitude");
        mAzimuth = hillshadeParameters.getInt("azimuth");
        mSlopeType = (SlopeType) hillshadeParameters.getSerializable("slope_type");
    }

    AlertDialog.Builder paramDialog = new AlertDialog.Builder(getContext());
    @SuppressLint("InflateParams")
    View dialogView = inflater.inflate(R.layout.hillshade_dialog_box, null);
    paramDialog.setView(dialogView);
    paramDialog.setTitle(R.string.dialog_title);
    paramDialog.setNegativeButton("Cancel", (dialog, which) -> dismiss());
    paramDialog.setPositiveButton("Render", (dialog, which) -> {
        ParametersListener activity = (ParametersListener) getActivity();
        activity.returnParameters(mAltitude, mAzimuth, mSlopeType);
    });

    mCurrAltitudeTextView = dialogView.findViewById(R.id.hillshade_curr_altitude_text);
    SeekBar altitudeSeekBar = dialogView.findViewById(R.id.hillshade_altitude_seek_bar);
    altitudeSeekBar.setMax(90); //altitude is restricted to 0 - 90
    //set initial altitude value
    updateAltitudeSeekBar(altitudeSeekBar);
    altitudeSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            mAltitude = progress;
            updateAltitudeSeekBar(seekBar);
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    });

    mCurrAzimuthTextView = dialogView.findViewById(R.id.hillshade_curr_azimuth_text);
    SeekBar azimuthSeekBar = dialogView.findViewById(R.id.hillshade_azimuth_seek_bar);
    azimuthSeekBar.setMax(360); //azimuth measured in degrees 0 - 360
    //set initial azimuth value
    updateAzimuthSeekBar(azimuthSeekBar);
    azimuthSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            mAzimuth = progress;
            updateAzimuthSeekBar(seekBar);
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    });

    List<String> slopeTypeArray = new ArrayList<>();
    slopeTypeArray.add("None"); //ordinals:0
    slopeTypeArray.add("Degree"); //1
    slopeTypeArray.add("Percent rise"); //2
    slopeTypeArray.add("Scaled"); //3

    ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<>(getContext(), R.layout.hillshade_spinner_text_view,
            slopeTypeArray);

    Spinner slopeTypeSpinner = dialogView.findViewById(R.id.hillshade_slope_type_spinner);
    slopeTypeSpinner.setAdapter(spinnerAdapter);
    slopeTypeSpinner.setSelection(mSlopeType.ordinal());
    slopeTypeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            switch (position) {
            case 0:
                mSlopeType = SlopeType.NONE;
                break;
            case 1:
                mSlopeType = SlopeType.DEGREE;
                break;
            case 2:
                mSlopeType = SlopeType.PERCENT_RISE;
                break;
            case 3:
                mSlopeType = SlopeType.SCALED;
                break;
            }
        }

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

    return paramDialog.create();
}

From source file:com.sino.conerimageview.ExampleActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.example_activity);

    //    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    Spinner navSpinner = (Spinner) findViewById(R.id.spinner_nav);

    navSpinner.setAdapter(ArrayAdapter.createFromResource(navSpinner.getContext(), R.array.action_list,
            android.R.layout.simple_spinner_dropdown_item));

    navSpinner.setOnItemSelectedListener(this);

    if (savedInstanceState == null) {
        navSpinner.setSelection(0);
    }/*from   ww w. ja  va  2 s .c o  m*/
}

From source file:com.bar.roundedimageview.example.ExampleActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.example_activity);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    Spinner navSpinner = (Spinner) findViewById(R.id.spinner_nav);

    navSpinner.setAdapter(ArrayAdapter.createFromResource(navSpinner.getContext(), R.array.action_list,
            android.R.layout.simple_spinner_dropdown_item));

    navSpinner.setOnItemSelectedListener(this);

    if (savedInstanceState == null) {
        navSpinner.setSelection(0);
    }//from   www  . ja v  a2 s  . c o m
}

From source file:com.tassadar.multirommgr.installfragment.InstallCard.java

@Override
public View getCardContent(Context context) {
    m_view = LayoutInflater.from(context).inflate(R.layout.install_card, null);

    Resources res = m_view.getResources();

    CheckBox b = (CheckBox) m_view.findViewById(R.id.install_multirom);
    b.setText(res.getString(R.string.install_multirom, m_manifest.getMultiromVersion()));
    b.setChecked(m_manifest.hasMultiromUpdate());
    b.setOnCheckedChangeListener(this);

    b = (CheckBox) m_view.findViewById(R.id.install_recovery);
    if (m_manifest.getRecoveryFile() != null) {
        final Date rec_date = m_manifest.getRecoveryVersion();
        final String recovery_ver = Recovery.DISPLAY_FMT.format(rec_date);
        b.setText(res.getString(R.string.install_recovery, recovery_ver));
        b.setChecked(m_manifest.hasRecoveryUpdate());
        b.setOnCheckedChangeListener(this);

        // Force user to install recovery if not yet installed - it is needed to flash ZIPs
        if (m_manifest.hasRecoveryUpdate() && m_forceRecovery) {
            b.append(Html.fromHtml(res.getString(R.string.required)));
            b.setClickable(false);//from   w w w  .  ja v  a 2 s .  c om
        }
    } else {
        b.setChecked(false);
        b.setVisibility(View.GONE);
    }

    ArrayAdapter<String> adapter = new ArrayAdapter<String>(context,
            android.R.layout.simple_spinner_dropdown_item);
    adapter.addAll(m_manifest.getKernels().keySet());
    Spinner s = (Spinner) m_view.findViewById(R.id.kernel_options);
    s.setAdapter(adapter);
    s.setEnabled(false);
    s.setSelection(getDefaultKernel());

    b = (CheckBox) m_view.findViewById(R.id.install_kernel);
    b.setOnCheckedChangeListener(this);
    b.setEnabled(!adapter.isEmpty());
    b.setChecked(!adapter.isEmpty() && m_manifest.hasKernelUpdate());

    Button install_btn = (Button) m_view.findViewById(R.id.install_btn);
    install_btn.setOnClickListener(this);

    ImageButton changelog_btn = (ImageButton) m_view.findViewById(R.id.changelog_btn);
    if (m_manifest.getChangelogs() == null || m_manifest.getChangelogs().length == 0)
        changelog_btn.setVisibility(View.GONE);
    else
        changelog_btn.setOnClickListener(this);

    if (m_savedState != null)
        restoreInstanceState();

    enableInstallBtn();
    return m_view;
}

From source file:com.gsma.rcs.provisioning.local.LoggerProvisioning.java

@Override
public void displayRcsSettings() {
    if (sLogger.isActivated()) {
        sLogger.debug("displayRcsSettings");
    }/*from www.ja v a2  s  .c om*/
    mHelper.setBoolCheckBox(R.id.TraceActivated, RcsSettingsData.TRACE_ACTIVATED);
    mHelper.setBoolCheckBox(R.id.SipTraceActivated, RcsSettingsData.SIP_TRACE_ACTIVATED);
    mHelper.setBoolCheckBox(R.id.MediaTraceActivated, RcsSettingsData.MEDIA_TRACE_ACTIVATED);
    mHelper.setStringEditText(R.id.SipTraceFile, RcsSettingsData.SIP_TRACE_FILE);

    Spinner spinner = (Spinner) mRootView.findViewById(R.id.TraceLevel);
    ArrayAdapter<String> adapter = new ArrayAdapter<>(getActivity(), android.R.layout.simple_spinner_item,
            TRACE_LEVEL);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinner.setAdapter(adapter);
    spinner.setSelection(sRcsSettings.getTraceLevel());
}

From source file:se.eliga.aves.birddetail.BirdDetailsTabActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.bird_details_tab_layout);

    final String latinSpecies = getIntent().getExtras().getString(BirdListFragment.LATIN_SPECIES);
    final String englishSpecies = getIntent().getExtras().getString(BirdListFragment.ENGLISH_SPECIES);
    final String swedishFamily = getIntent().getExtras().getString(BirdListFragment.SWEDISH_FAMILY);

    Bundle bundle = new Bundle(1);
    bundle.putString(BirdSpeciesWebFragment.ENGLISH_SPECIES, englishSpecies);
    bundle.putString(BirdSpeciesXenoCantoPlayerFragment.LATIN_SPECIES, latinSpecies);

    tabHost = (FragmentTabHost) findViewById(android.R.id.tabhost);
    tabHost.setup(this, getSupportFragmentManager(), R.id.tabFrameLayout);

    tabHost.addTab(//  w  w w  .j  a v  a  2  s.c om
            tabHost.newTabSpec("Wikipedia").setIndicator(getText(R.string.tab_wikipedia),
                    getResources().getDrawable(android.R.drawable.star_on)),
            BirdSpeciesWebFragment.class, bundle);
    tabHost.addTab(
            tabHost.newTabSpec("Flickr").setIndicator(getText(R.string.tab_photos),
                    getResources().getDrawable(android.R.drawable.star_on)),
            BirdSpeciesFlickrGalleryFragment.class, bundle);
    tabHost.addTab(
            tabHost.newTabSpec("xeno-canto").setIndicator(getText(R.string.tab_sounds),
                    getResources().getDrawable(android.R.drawable.star_on)),
            BirdSpeciesXenoCantoPlayerFragment.class, bundle);
    tabHost.addTab(
            tabHost.newTabSpec("Statistik").setIndicator(getText(R.string.tab_facts),
                    getResources().getDrawable(android.R.drawable.star_on)),
            BirdSpeciesFactsFragment.class, bundle);
    tabHost.addTab(tabHost.newTabSpec("Karta").setIndicator(getText(R.string.tab_map),
            getResources().getDrawable(android.R.drawable.star_on)), MapFragment.class, bundle);

    TabWidget tabWidget = (TabWidget) findViewById(android.R.id.tabs);
    LinearLayout linearLayout = (LinearLayout) tabWidget.getParent();
    HorizontalScrollView horizontalScrollView = new HorizontalScrollView(this);
    horizontalScrollView.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
            FrameLayout.LayoutParams.WRAP_CONTENT));
    linearLayout.addView(horizontalScrollView, 0);
    linearLayout.removeView(tabWidget);
    horizontalScrollView.addView(tabWidget);
    horizontalScrollView.setHorizontalScrollBarEnabled(false);

    BirdListSpinnerAdapter birdListSpinnerAdapter = createAdapter();
    birdListSpinnerAdapter.setFilterFamily(swedishFamily);
    birdListSpinnerAdapter.initialize(getSharedPreferences(Constants.BIRD_APP_SETTINGS, Context.MODE_PRIVATE));
    if (BirdListAdapter.SortOption.PHYLOGENETIC.equals(birdListSpinnerAdapter.getSortOption())) {
        birdListSpinnerAdapter.setSortOption(BirdListAdapter.SortOption.SWEDISH);
    }

    birdListSpinnerAdapter.refresh();
    birdListSpinnerAdapter.notifyDataSetChanged();

    Spinner spinner = new Spinner(this);
    spinner.setId(R.id.birdspecies_spinner);
    spinner.setAdapter(birdListSpinnerAdapter);
    spinner.setGravity(Gravity.FILL_HORIZONTAL);

    spinner.setSelection(birdListSpinnerAdapter.getPosition(new Bird(latinSpecies)));
    spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
            BirdSpeciesFragment fragment = (BirdSpeciesFragment) getSupportFragmentManager()
                    .findFragmentByTag(tabHost.getCurrentTabTag());
            Spinner spinner = (Spinner) getActionBar().getCustomView().findViewById(R.id.birdspecies_spinner);
            fragment.loadBird((Bird) spinner.getSelectedItem());
        }

        @Override
        public void onNothingSelected(AdapterView<?> adapterView) {
        }
    });
    getActionBar().setCustomView(spinner);
    getActionBar().setDisplayOptions(
            ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_CUSTOM);

}

From source file:com.tapchatapp.android.app.activity.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int currentIndex = getCurrentIndex();

    switch (item.getItemId()) {
    case R.id.join_channel: {
        View dialogView = this.getLayoutInflater().inflate(R.layout.dialog_join_channel, null);
        Spinner serverSpinner = (Spinner) dialogView.findViewById(R.id.server);
        serverSpinner.setAdapter(ServerSpinnerAdapter.create(this, getService()));
        serverSpinner.setSelection(currentIndex);
        new AlertDialog.Builder(this).setTitle(R.string.join_channel).setView(dialogView)
                .setPositiveButton(R.string.join, new DialogInterface.OnClickListener() {
                    @Override/* w w  w . j  ava 2s . c  o m*/
                    public void onClick(DialogInterface dialogInterface, int i) {
                        Spinner serverSpinner = (Spinner) ((AlertDialog) dialogInterface)
                                .findViewById(R.id.server);
                        Map serverItem = (Map) serverSpinner.getSelectedItem();

                        long connectionId = (Long) serverItem.get("id");
                        Connection connection = getService().getConnection(connectionId);

                        EditText channelEditText = (EditText) ((AlertDialog) dialogInterface)
                                .findViewById(R.id.channel);
                        connection.join(channelEditText.getText().toString(), null);
                    }

                }).setNegativeButton(android.R.string.cancel, null).show();
        return true;
    }

    case R.id.message_user: {
        View dialogView = this.getLayoutInflater().inflate(R.layout.dialog_message_user, null);
        Spinner serverSpinner = (Spinner) dialogView.findViewById(R.id.server);
        serverSpinner.setAdapter(ServerSpinnerAdapter.create(this, getService()));
        serverSpinner.setSelection(currentIndex);

        new AlertDialog.Builder(this).setTitle(R.string.send_message).setView(dialogView)
                .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        Spinner serverSpinner = (Spinner) ((AlertDialog) dialogInterface)
                                .findViewById(R.id.server);
                        Map serverItem = (Map) serverSpinner.getSelectedItem();

                        long connectionId = (Long) serverItem.get("id");
                        Connection connection = getService().getConnection(connectionId);

                        EditText nickEditText = (EditText) ((AlertDialog) dialogInterface)
                                .findViewById(R.id.nick);
                        connection.say(nickEditText.getText().toString(), null, null);
                    }

                }).setNegativeButton(android.R.string.cancel, null).show();
        return true;
    }

    case R.id.preferences:
        startActivity(new Intent(this, PreferencesActivity.class));
        return true;

    case R.id.contribute:
        Intent intent = new Intent(Intent.ACTION_VIEW, CONTRIBUTE_URI);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(intent);
        return true;
    }
    return false;
}

From source file:com.android.nsboc.ComposeFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (mItem != null) {
        switch (mItem.id + "") {
        case "1":
            mRootView = inflater.inflate(R.layout.form_unlicensed, container, false);
            break;
        case "2":
            mRootView = inflater.inflate(R.layout.form_salon, container, false);
            break;
        }/* w  w w  .  j  a va  2 s.  c om*/
    }

    showCurrentDateInEditText();

    ToggleButton complianceToggle = (ToggleButton) mRootView.findViewById(R.id.compliance_toggle);
    if (complianceToggle != null) {
        final LinearLayout complianceContainer = (LinearLayout) mRootView
                .findViewById(R.id.compliance_container);

        complianceToggle.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (!isChecked) {
                    complianceContainer.setVisibility(View.VISIBLE);

                    final LinearLayout complianceLayout = (LinearLayout) View.inflate(getActivity(),
                            R.layout.compliance_layout, null);

                    Spinner violationTypeSpinner = (Spinner) complianceLayout
                            .findViewById(R.id.violation_type_spinner);
                    violationTypeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
                        @Override
                        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                            switch (position) {
                            case 0:
                                complianceLayout.findViewById(R.id.type_citation_container)
                                        .setVisibility(View.VISIBLE);
                                break;
                            case 1:
                                complianceLayout.findViewById(R.id.type_citation_container)
                                        .setVisibility(View.GONE);
                                break;
                            }
                        }

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

                    ToggleButton anotherToggle = (ToggleButton) complianceLayout
                            .findViewById(R.id.compliance_toggle);
                    anotherToggle.setOnCheckedChangeListener(getNextToggleListener(complianceLayout));

                    complianceContainer.addView(complianceLayout);
                } else {
                    complianceContainer.setVisibility(View.GONE);
                }
            }
        });
    }

    ToggleButton emailToggle = (ToggleButton) mRootView.findViewById(R.id.emailTo_toggle);
    if (emailToggle != null) {
        final LinearLayout emailLayout = (LinearLayout) mRootView.findViewById(R.id.emailTo_layout);

        emailToggle.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (isChecked) {
                    emailLayout.setVisibility(View.VISIBLE);
                } else {
                    emailLayout.setVisibility(View.GONE);
                }
            }
        });
    }

    final TextView noticeTextView = (TextView) mRootView.findViewById(R.id.notice_textview);
    if (noticeTextView != null) {
        noticeTextView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (noticeTextView.getCurrentTextColor() == Color.BLACK) {
                    noticeTextView.setText(R.string.civil_citation_header);
                    noticeTextView.setTextColor(Color.parseColor("#17405e"));
                    noticeTextView.setText(Html.fromHtml("<u>" + noticeTextView.getText() + "</u>"));
                    mRootView.findViewById(R.id.civil_citation).requestFocus();
                } else {
                    noticeTextView.setText(R.string.civil_citation_notice);
                    noticeTextView.setMaxLines(Integer.MAX_VALUE);
                    noticeTextView.setTextColor(Color.BLACK);
                    noticeTextView.setText(
                            noticeTextView.getText().toString().replace("<u>", "").replace("</u>", ""));
                }
            }
        });
    }

    Spinner stateSpinner = (Spinner) mRootView.findViewById(R.id.state);
    if (stateSpinner != null) {
        stateSpinner.setSelection(27);
    }

    return mRootView;
}

From source file:com.kaliturin.blacklist.fragments.AddOrEditContactFragment.java

private void setNumberType(View row, int type) {
    int position = 0;
    switch (type) {
    case ContactNumber.TYPE_CONTAINS:
        position = 1;//from ww w  . j a v a 2 s . com
        break;
    case ContactNumber.TYPE_STARTS:
        position = 2;
        break;
    case ContactNumber.TYPE_ENDS:
        position = 3;
        break;
    }
    Spinner numberTypeSpinner = (Spinner) row.findViewById(R.id.spinner_number_type);
    numberTypeSpinner.setSelection(position);
}