Example usage for android.widget ArrayAdapter getPosition

List of usage examples for android.widget ArrayAdapter getPosition

Introduction

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

Prototype

public int getPosition(@Nullable T item) 

Source Link

Document

Returns the position of the specified item in the array.

Usage

From source file:com.armtimes.dialogs.DialogSettings.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    View settingsView = getActivity().getLayoutInflater().inflate(R.layout.dialog_settings, null);

    // Initialize and set Storage Spinner adapter.
    Spinner storageSpinner = (Spinner) settingsView.findViewById(R.id.spinnerImageStorage);
    ArrayAdapter storageAdapter = ArrayAdapter.createFromResource(getActivity(), R.array.image_storage_array,
            android.R.layout.simple_spinner_item);
    storageAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    storageSpinner.setAdapter(storageAdapter);

    storageSpinner.setSelection(getImageStorage(getActivity()));

    storageSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override/*from w  ww.  j  a va  2 s . c o  m*/
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            setImageStorage(position);
        }

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

    // Initialize and set Saved news number Spinner Adapter
    Spinner savedNewsSpinner = (Spinner) settingsView.findViewById(R.id.spinnerStoredArticlesCount);
    ArrayAdapter savedNewsAdapter = ArrayAdapter.createFromResource(getActivity(),
            R.array.saved_articles_number_array, android.R.layout.simple_spinner_item);
    savedNewsAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    savedNewsSpinner.setAdapter(savedNewsAdapter);

    int pos = savedNewsAdapter.getPosition(Integer.toString(getAllowedNewsCount(getActivity())));
    savedNewsSpinner.setSelection(pos);

    savedNewsSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            final String value = (String) parent.getItemAtPosition(position);
            setSavedNewsCount(value);
        }

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

    initImageQualityControllers(settingsView);
    initFontSizeStuff(settingsView);

    // Creates About Us Alert dialog which extends from DialogFragment.
    return new AlertDialog.Builder(getActivity()).setTitle(R.string.settings)
            .setNeutralButton(R.string.about_us_close, null).setView(settingsView).create();
}

From source file:it.ielettronica.TVS.tabFromDB.java

@Override
public void onResume() {

    super.onResume();
    if (isAdded()) {

        sitesMusic = (ListView) view.findViewById(R.id.sitesMusic);
        sGroup = (Spinner) view.findViewById(R.id.spGroup);
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(getContext(),
                android.R.layout.simple_spinner_item, groupsS);
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        sGroup.setAdapter(adapter);/*w w  w .j a  v  a2 s  . c  om*/

        //if (isExecutedOutSite == Boolean.FALSE) {

        int spinnerPosition = adapter.getPosition(GroupSeletced);
        if (spinnerPosition != -1) {
            sGroup.setSelection(spinnerPosition);
            GroupVSeletced = groupsV.get(spinnerPosition);
            sitesMusic.setSelection(MainActivity.posRemoteListBeforeExecuted);
        } else {

            GroupSeletced = "English Channels";
            GroupVSeletced = new StackGroup();
            GroupVSeletced.setGroupName(GroupSeletced);
            GroupVSeletced.setGroupLevel(0);
            GroupVSeletced.setGroupType(0);

            RemoteCommunications rm = new RemoteCommunications();
            List<StackSite> returnedSite = new ArrayList<StackSite>();
            rm.getStackSites(returnedSite, GroupSeletced, new GetSiteCallback() {
                @Override
                public void done(List<StackSite> returnedSite, boolean Result) {
                    itemsSS = returnedSite;
                    List<StackSite> itemsSSF = getFilterStackSite(itemsSS, searchText.getText().toString());
                    adapterBtn2 = new MyListAdapterExt(getContext(), itemsSSF, sitesMusic, GroupVSeletced);
                    sitesMusic.setAdapter(adapterBtn2);
                    sitesMusic.setSelection(MainActivity.posRemoteListBeforeExecuted);
                }

            });

        }

        //}

    }
}

From source file:ca.rmen.android.networkmonitor.app.prefs.SelectFieldsFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    Activity activity = getActivity();/*from w  w w .  j a va 2s  . c  o m*/
    // Build the list of choices for the user.  Look up the friendly label of each column name, and pre-select the one the user chose last time.
    final String[] columnLabels = NetMonColumns.getColumnLabels(activity);
    ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(activity,
            android.R.layout.simple_list_item_multiple_choice, columnLabels);
    setListAdapter(adapter);
    ListView lv = getListView();
    lv.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
    // Preselect the columns from the preferences
    List<String> selectedColumns = NetMonPreferences.getInstance(activity).getSelectedColumns();
    for (String selectedColumn : selectedColumns) {
        String selectedColumnLabel = NetMonColumns.getColumnLabel(activity, selectedColumn);
        int position = adapter.getPosition(selectedColumnLabel);
        lv.setItemChecked(position, true);
    }
}

From source file:org.mythdroid.fragments.RecEditSchedFragment.java

private void setViews() {

    dupMatchSpinner = ((Spinner) view.findViewById(R.id.dupMatch));

    final ArrayAdapter<String> dupMatchAdapter = new ArrayAdapter<String>(activity,
            android.R.layout.simple_spinner_item);
    dupMatchAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    for (RecDupMethod method : RecDupMethod.values())
        dupMatchAdapter.add(method.msg());

    dupMatchSpinner.setAdapter(dupMatchAdapter);
    if (ref.recId == 0 || ref.dupMethod == null)
        dupMatchSpinner.setSelection(dupMatchAdapter.getPosition(RecDupMethod.SUBTHENDESC.msg()));
    else//from   ww  w .  j a v a 2  s  .  c o m
        dupMatchSpinner.setSelection(ref.dupMethod.ordinal());
    dupMatchSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
            ref.dupMethod = RecDupMethod.values()[pos];
            ref.checkChildren();
        }

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

    });

    dupInSpinner = ((Spinner) view.findViewById(R.id.dupIn));

    final ArrayAdapter<String> dupInAdapter = new ArrayAdapter<String>(activity,
            android.R.layout.simple_spinner_item);
    dupInAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    for (RecDupIn set : RecDupIn.values())
        dupInAdapter.add(set.msg());

    dupInSpinner.setAdapter(dupInAdapter);
    if (ref.recId == 0 || ref.dupIn == null)
        dupInSpinner.setSelection(dupInAdapter.getPosition(RecDupIn.ALL.msg()));
    else
        dupInSpinner.setSelection(ref.dupIn.ordinal());
    dupInSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
            ref.dupIn = RecDupIn.values()[pos];
            ref.checkChildren();
        }

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

    });

    epiFilterSpinner = ((Spinner) view.findViewById(R.id.epiFilter));

    ArrayAdapter<String> epiFilterAdapter = new ArrayAdapter<String>(activity,
            android.R.layout.simple_spinner_item);
    epiFilterAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    for (RecEpiFilter filter : RecEpiFilter.values())
        epiFilterAdapter.add(filter.msg());

    epiFilterSpinner.setAdapter(epiFilterAdapter);
    if (ref.epiFilter == null)
        epiFilterSpinner.setSelection(RecEpiFilter.NONE.ordinal());
    else
        epiFilterSpinner.setSelection(ref.epiFilter.ordinal());
    epiFilterSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
            ref.epiFilter = RecEpiFilter.values()[pos];
            ref.checkChildren();
        }

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

    });
}

From source file:it.polimi.spf.demo.couponing.provider.CategoryFragment.java

private void onDataReady() {
    String[] categories = ProviderApplication.get().getCouponDatabase().getCategories();
    ArrayAdapter<String> adapter = new ArrayAdapter<>(getActivity(),
            android.R.layout.simple_list_item_multiple_choice, categories);
    mList.setAdapter(adapter);/*from w  w  w . ja v  a 2 s  .com*/

    //FIXME nullpointerexception somewhere, probably on mContainer,
    //FIXME please fix this if you found this bug
    String[] interests = mContainer.getFieldValue(ProfileField.INTERESTS);
    if (interests == null) {
        interests = new String[0];
    }

    for (String interest : interests) {
        int i = adapter.getPosition(interest);
        if (i > -1) {
            mList.setItemChecked(i, true);
        }
    }

    mList.setOnItemClickListener(mCategoryListener);
}

From source file:ar.uba.fi.mileem.SimpleFormActivity.java

@SuppressWarnings("unchecked")
private void initForm() {

    operationtypeSpinner.setAdapter(new OperationTypeSpinnerAdapter(this));

    ApiHelper.getInstance().getNeighborhoodsByCity(new JsonCacheHttpResponseHandler() {
        public void onSuccess(int statusCode, Header[] headers, JSONArray response) {
            super.onSuccess(statusCode, headers, response);
            ArrayAdapter<SimpleEntry<String, String>> adapter = new SpinnerAdapter(SimpleFormActivity.this,
                    genericJSONArrayToEntryList(response));
            neighborhoodsSpinner.setAdapter(adapter);
            neighborhoodsSpinner.setEnabled(true);
            enableSearch();/*from w  w w  . j  ava 2s .c o  m*/
            if (SearchForm.getField(FormField.NEIGHBORHOOD) != null) {
                int position = adapter.getPosition(new SimpleEntry<String, String>(
                        (String) SearchForm.getField(FormField.NEIGHBORHOOD), null));
                neighborhoodsSpinner.setSelection(position);
            }
        }

        public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {
            super.onFailure(statusCode, headers, throwable, errorResponse);
            DialogFactory.getFactory().showError(SimpleFormActivity.this, R.string.oops,
                    R.string.connection_error, false);
        }
    });

    ApiHelper.getInstance().getPropertyTypes(new JsonCacheHttpResponseHandler() {
        public void onSuccess(int statusCode, Header[] headers, JSONArray response) {
            super.onSuccess(statusCode, headers, response);
            ArrayAdapter<SimpleEntry<String, String>> adapter = new SpinnerAdapter(SimpleFormActivity.this,
                    genericJSONArrayToEntryList(response));
            propertyTypeSpinner.setAdapter(adapter);
            propertyTypeSpinner.setEnabled(true);
            enableSearch();
            if (SearchForm.getField(FormField.PROPERTY_TYPE) != null) {
                int position = adapter.getPosition(new SimpleEntry<String, String>(
                        (String) SearchForm.getField(FormField.PROPERTY_TYPE), null));
                propertyTypeSpinner.setSelection(position);

            }
        }

        @Override
        public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {
            super.onFailure(statusCode, headers, throwable, errorResponse);
            DialogFactory.getFactory().showError(SimpleFormActivity.this, R.string.oops,
                    R.string.connection_error, false);
        }
    });

    ArrayAdapter<SimpleEntry<String, String>> adapter = (ArrayAdapter<SimpleEntry<String, String>>) operationtypeSpinner
            .getAdapter();
    if (SearchForm.getField(FormField.OPERATION_TYPE) != null) {
        int position = adapter.getPosition(
                new SimpleEntry<String, String>((String) SearchForm.getField(FormField.OPERATION_TYPE), null));
        operationtypeSpinner.setSelection(position);
    }

    includeNeighborsCheck.setChecked((Boolean) SearchForm.getField(FormField.SURROUNDING_AREAS));
}

From source file:com.gmail.taneza.ronald.carbs.myfoods.MyFoodDetailsActivity.java

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

    setContentView(R.layout.activity_my_food_details);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    mFoodDbAdapter = ((CarbsApp) getApplication()).getFoodDbAdapter();

    // Get the message from the intent
    Intent intent = getIntent();/*from ww  w  .  j av a2  s. c  o m*/

    mFoodItem = intent.getParcelableExtra(MY_FOOD_ITEM_MESSAGE);
    FoodItemInfo foodItemInfo;

    Mode mode = Mode.values()[intent.getIntExtra(MY_FOOD_ACTIVITY_MODE_MESSAGE, Mode.NewFood.ordinal())];
    mMode = mode;
    if (mode == Mode.NewFood) {
        foodItemInfo = new FoodItemInfo(mFoodItem, NEW_FOOD_DEFAULT_NAME, NEW_FOOD_DEFAULT_QUANTITY_PER_UNIT,
                NEW_FOOD_DEFAULT_CARBS, NEW_FOOD_DEFAULT_UNIT_TEXT);
    } else {
        foodItemInfo = mFoodDbAdapter.getFoodItemInfo(mFoodItem);

        setTitle(R.string.title_activity_my_food_edit);
        Button okButton = (Button) findViewById(R.id.my_food_ok_button);
        okButton.setText(R.string.save_food_details);
    }

    mFoodNameTextView = (TextView) findViewById(R.id.my_food_name);
    mFoodNameTextView.setText(foodItemInfo.getName());
    // Request focus and show soft keyboard automatically
    mFoodNameTextView.requestFocus();
    getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);

    mQuantityEditText = (EditText) findViewById(R.id.my_food_quantity_edit);
    mQuantityEditText.setText(Integer.toString(foodItemInfo.getQuantityPerUnit()));

    mQuantityUnitTextSpinner = (Spinner) findViewById(R.id.my_food_quantity_unit_spinner);
    // Create an ArrayAdapter using the string array and a default spinner layout
    ArrayAdapter<CharSequence> arrayAdapter = ArrayAdapter.createFromResource(this,
            R.array.quantity_unit_text_array, android.R.layout.simple_spinner_item);
    // Specify the layout to use when the list of choices appears
    arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    // Apply the adapter to the spinner
    mQuantityUnitTextSpinner.setAdapter(arrayAdapter);
    mQuantityUnitTextSpinner.setSelection(arrayAdapter.getPosition(foodItemInfo.getUnitText()));

    mNumCarbsTextView = (TextView) findViewById(R.id.my_food_carbs);

    // Display decimal place only when non-zero, so it's easier to edit
    String numCarbsString;
    float numCarbs = foodItemInfo.getNumCarbsInGrams();
    if (numCarbs == (int) numCarbs) {
        numCarbsString = String.format(Locale.getDefault(), "%.0f", numCarbs);
    } else {
        numCarbsString = String.format(Locale.getDefault(), "%.1f", numCarbs);
    }
    mNumCarbsTextView.setText(numCarbsString);
}

From source file:com.chaitu.lmscalendar.ui.UrlDialog.java

@Override
@NonNull//from   www . j a  v a2 s .c o  m
public Dialog onCreateDialog(Bundle savedInstanceState) {

    mActivity = (MainActivity) getActivity();

    ViewGroup nullViewGroup = null; // Avoid bad lint warning in inflate()
    View view = mActivity.getLayoutInflater().inflate(R.layout.urldialog, nullViewGroup);

    mTextCalendarUrl = (EditText) view.findViewById(R.id.TextCalendarUrl);
    mTextUsername = (EditText) view.findViewById(R.id.TextUsername);
    mTextPassword = (EditText) view.findViewById(R.id.TextPassword);

    Settings settings = mActivity.getSettings();
    mTextCalendarUrl.setText(settings.getString(Settings.PREF_LASTURL));
    mTextUsername.setText(settings.getString(Settings.PREF_LASTURLUSERNAME));
    mTextPassword.setText(settings.getString(Settings.PREF_LASTURLPASSWORD));

    mTextCalendarUrl.selectAll();

    //sync intervals
    mSpinnerSyncInterval = (Spinner) view.findViewById(R.id.sync_interval);
    // Create an ArrayAdapter using the string array and a default spinner layout
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(mActivity.getApplicationContext(),
            R.array.sync_intervals, android.R.layout.simple_spinner_item);
    // Specify the layout to use when the list of choices appears
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    // Apply the adapter to the spinner
    mSpinnerSyncInterval.setAdapter(adapter);

    mSpinnerCalendar = (Spinner) view.findViewById(R.id.calendar);
    //calendar
    List<CalendarModel> calendars = EventUtil.readCalendars(mActivity.getApplicationContext(),
            mActivity.getApplicationContext().getContentResolver());

    ArrayAdapter<CalendarModel> adapter1 = new ArrayAdapter<CalendarModel>(mActivity.getApplicationContext(),
            android.R.layout.simple_spinner_dropdown_item, calendars);
    mSpinnerCalendar.setAdapter(adapter1);

    String name = settings.getString(Settings.PREF_LASTCALENDARNAME);
    int id = settings.getInt(Settings.PREF_LASTCALENDARID);
    if (id > 0 && name != null && !name.isEmpty()) {
        CalendarModel cal = new CalendarModel(id, name);
        mSpinnerCalendar.setSelection(adapter1.getPosition(cal));
    }

    DialogInterface.OnClickListener okTask;
    okTask = new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface iface, int id) {
            // We override this in onStart()
        }
    };

    DialogInterface.OnClickListener cancelTask;
    cancelTask = new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface iface, int id) {
            iface.cancel();
        }
    };

    AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
    AlertDialog dlg = builder.setIcon(R.mipmap.ic_launcher).setTitle(R.string.enter_source_url).setView(view)
            .setPositiveButton(android.R.string.ok, okTask)
            .setNegativeButton(android.R.string.cancel, cancelTask).create();
    dlg.getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
    return dlg;
}

From source file:org.tigase.mobile.muc.JoinMucDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final Dialog dialog = new Dialog(getActivity());
    dialog.setCancelable(true);/*from   ww  w .ja v a  2  s. c o  m*/
    dialog.setCanceledOnTouchOutside(true);

    dialog.setContentView(R.layout.join_room_dialog);
    dialog.setTitle(getString(R.string.aboutButton));

    ArrayList<String> accounts = new ArrayList<String>();
    for (Account account : AccountManager.get(getActivity()).getAccountsByType(Constants.ACCOUNT_TYPE)) {
        accounts.add(account.name);
    }

    final Spinner accountSelector = (Spinner) dialog.findViewById(R.id.muc_accountSelector);
    final Button joinButton = (Button) dialog.findViewById(R.id.muc_joinButton);
    final Button cancelButton = (Button) dialog.findViewById(R.id.muc_cancelButton);
    final TextView name = (TextView) dialog.findViewById(R.id.muc_name);
    final TextView roomName = (TextView) dialog.findViewById(R.id.muc_roomName);
    final TextView mucServer = (TextView) dialog.findViewById(R.id.muc_server);
    final TextView nickname = (TextView) dialog.findViewById(R.id.muc_nickname);
    final TextView password = (TextView) dialog.findViewById(R.id.muc_password);
    final CheckBox autojoin = (CheckBox) dialog.findViewById(R.id.muc_autojoin);

    ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item,
            accounts.toArray(new String[] {}));
    accountSelector.setAdapter(adapter);

    Bundle data = getArguments();
    final boolean editMode = data != null && data.containsKey("editMode") && data.getBoolean("editMode");
    final String id = data != null ? data.getString("id") : null;

    if (data != null) {
        accountSelector.setSelection(adapter.getPosition(data.getString("account")));

        name.setText(data.getString("name"));
        roomName.setText(data.getString("room"));
        mucServer.setText(data.getString("server"));
        nickname.setText(data.getString("nick"));
        password.setText(data.getString("password"));
        autojoin.setChecked(data.getBoolean("autojoin"));
    }

    if (!editMode) {
        name.setVisibility(View.GONE);
        autojoin.setVisibility(View.GONE);
    } else {
        joinButton.setText("Save");
    }

    cancelButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            dialog.dismiss();

        }
    });
    joinButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            if (editMode) {

                BareJID account = BareJID.bareJIDInstance(accountSelector.getSelectedItem().toString());
                final Jaxmpp jaxmpp = ((MessengerApplication) getActivity().getApplicationContext())
                        .getMultiJaxmpp().get(account);

                Bundle data = new Bundle();

                data.putString("id", id);
                data.putString("account", account.toString());
                data.putString("name", name.getText().toString());
                data.putString("room", roomName.getText().toString());
                data.putString("server", mucServer.getText().toString());
                data.putString("nick", nickname.getText().toString());
                data.putString("password", password.getText().toString());
                data.putBoolean("autojoin", autojoin.isChecked());

                ((BookmarksActivity) getActivity()).saveItem(data);

                dialog.dismiss();
                return;
            }

            BareJID account = BareJID.bareJIDInstance(accountSelector.getSelectedItem().toString());
            final Jaxmpp jaxmpp = ((MessengerApplication) getActivity().getApplicationContext())
                    .getMultiJaxmpp().get(account);

            Runnable r = new Runnable() {

                @Override
                public void run() {
                    try {
                        Room room = jaxmpp.getModule(MucModule.class).join(
                                roomName.getEditableText().toString(), mucServer.getEditableText().toString(),
                                nickname.getEditableText().toString(), password.getEditableText().toString());
                        if (task != null)
                            task.execute(room);
                    } catch (Exception e) {
                        Log.w("MUC", "", e);
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                }
            };
            (new Thread(r)).start();
            dialog.dismiss();
        }
    });

    return dialog;
}

From source file:org.gnucash.android.ui.report.ReportsActivity.java

/**
 * Update the report type spinner/* ww  w .j  a v a  2s .  c  o  m*/
 */
public void updateReportTypeSpinner(ReportType reportType, String reportName) {
    if (reportType == mReportType)//if it is the same report type, don't change anything
        return;

    mReportType = reportType;
    ActionBar actionBar = getSupportActionBar();
    assert actionBar != null;
    ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(actionBar.getThemedContext(),
            android.R.layout.simple_list_item_1, mReportType.getReportNames());

    mSkipNextReportTypeSelectedRun = true; //selection event will be fired again
    mReportTypeSpinner.setAdapter(arrayAdapter);
    mReportTypeSpinner.setSelection(arrayAdapter.getPosition(reportName));
    mReportTypeSpinner.setOnItemSelectedListener(mReportTypeSelectedListener);

    toggleToolbarTitleVisibility();
}