Example usage for android.widget Spinner getCount

List of usage examples for android.widget Spinner getCount

Introduction

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

Prototype

@Override
    public int getCount() 

Source Link

Usage

From source file:Main.java

static int indexOf(Spinner _Spinner, String _String) {
    for (int i = 0; i < _Spinner.getCount(); ++i) {
        if (_Spinner.getItemAtPosition(i).toString().equalsIgnoreCase(_String))
            return i;
    }//from   ww w  . ja  va 2  s.  c o m
    return -1;
}

From source file:Main.java

public static void setSpinnerSelectionWithString(View view, int spinnerId, String text) {
    Spinner spinner = (Spinner) view.findViewById(spinnerId);

    int count = spinner.getCount();
    for (int i = 0; i < count; i++) {
        if (spinner.getItemAtPosition(i).toString().equals(text))
            spinner.setSelection(i);//w  w  w.ja v  a2 s.  c  om
    }
}

From source file:Main.java

public static int GetIndexSpinner(Spinner spinner, Object myfind) {

    int index = 0;

    for (int i = 0; i < spinner.getCount(); i++) {
        if (spinner.getItemAtPosition(i).equals(myfind)) {
            index = i;//from   w w  w.  j av  a 2  s .com
        }
    }
    return index;
}

From source file:com.ada.utils.Ui.java

public static void setSelection(Spinner spinner, String selection) {
    final int count = spinner.getCount();
    for (int i = 0; i < count; i++) {
        String item = spinner.getItemAtPosition(i).toString();
        if (item.equalsIgnoreCase(selection)) {
            spinner.setSelection(i);//  w w  w  .j a va  2s .  c om
        }
    }
}

From source file:Main.java

public static Callable<Boolean> notEmpty(final Spinner spinner) {
    return new Callable<Boolean>() {
        @Override// www.  j a v a  2  s .c  om
        public Boolean call() throws Exception {
            if (spinner == null) {
                throw new IllegalArgumentException("Spinner should not be null!");
            }
            return spinner.getCount() > 0;
        }
    };
}

From source file:com.sentaroh.android.TaskAutomation.Config.ProfileMaintenanceTimeProfile.java

final static private String getExecTimeByDateTimeType(final GlobalParameters mGlblParms, String rt,
        Spinner sp_hour, Spinner sp_min) {
    String sp_thh = "**", sp_tmm = "**";
    if (sp_hour.getCount() != 0)
        sp_thh = sp_hour.getSelectedItem().toString();
    if (sp_min.getCount() != 0)
        sp_tmm = sp_min.getSelectedItem().toString();

    if (rt.equals(PROFILE_DATE_TIME_TYPE_ONE_SHOT)) {
        //NOP//from   w w w . j  a v a 2 s  . co m
    } else if (rt.equals(PROFILE_DATE_TIME_TYPE_EVERY_YEAR)) {
    } else if (rt.equals(PROFILE_DATE_TIME_TYPE_EVERY_MONTH)) {
    } else if (rt.equals(PROFILE_DATE_TIME_TYPE_DAY_OF_THE_WEEK)) {
    } else if (rt.equals(PROFILE_DATE_TIME_TYPE_EVERY_DAY)) {
    } else if (rt.equals(PROFILE_DATE_TIME_TYPE_EVERY_HOUR)) {
        sp_thh = "**";
    } else if (rt.equals(PROFILE_DATE_TIME_TYPE_INTERVAL)) {
    }
    mGlblParms.util.addDebugMsg(1, "I",
            "getExecTimeByDateTimeType result=" + sp_thh + ":" + sp_tmm + ", repeat=" + rt);
    return sp_thh + ":" + sp_tmm;

}

From source file:com.sentaroh.android.TaskAutomation.Config.ProfileMaintenanceTimeProfile.java

final static private String getExecDateByDateTimeType(final GlobalParameters mGlblParms, String rt,
        Spinner sp_year, Spinner sp_month, Spinner sp_day) {
    String sp_yy = "----", sp_mm = "--", sp_dd = "--";
    if (sp_year.getCount() != 0)
        sp_yy = sp_year.getSelectedItem().toString();
    if (sp_month.getCount() != 0)
        sp_mm = sp_month.getSelectedItem().toString();
    if (sp_day.getCount() != 0)
        sp_dd = sp_day.getSelectedItem().toString();

    if (rt.equals(PROFILE_DATE_TIME_TYPE_ONE_SHOT)) {
        //NOP/* w w  w  . ja  v  a2s .c  o m*/
    } else if (rt.equals(PROFILE_DATE_TIME_TYPE_EVERY_YEAR)) {
        sp_yy = "****";
    } else if (rt.equals(PROFILE_DATE_TIME_TYPE_EVERY_MONTH)) {
        sp_yy = "****";
        sp_mm = "**";
    } else if (rt.equals(PROFILE_DATE_TIME_TYPE_DAY_OF_THE_WEEK)) {
        sp_yy = "****";
        sp_mm = "**";
        sp_dd = "**";
    } else if (rt.equals(PROFILE_DATE_TIME_TYPE_EVERY_DAY)) {
        sp_yy = "****";
        sp_mm = "**";
        sp_dd = "**";
    } else if (rt.equals(PROFILE_DATE_TIME_TYPE_EVERY_HOUR)) {
        sp_yy = "****";
        sp_mm = "**";
        sp_dd = "**";
    }
    mGlblParms.util.addDebugMsg(1, "I",
            "getExecDateByDateTimeType result=" + sp_yy + "/" + sp_mm + "/" + sp_dd + ", repeat=" + rt);
    return sp_yy + "/" + sp_mm + "/" + sp_dd;
}

From source file:eu.power_switch.gui.dialog.DeveloperOptionsDialog.java

private int getIndex(Spinner spinner, String myString) {
    int index = 0;

    for (int i = 0; i < spinner.getCount(); i++) {
        if (spinner.getItemAtPosition(i).toString().equalsIgnoreCase(myString)) {
            index = i;//  w ww.j a v a 2s .c o m
            break;
        }
    }
    return index;
}

From source file:de.hshannover.f4.trust.ironcontrol.view.SearchFragmentActivity.java

private int getSpinnerIndex(Spinner spinner, String s) {
    int index = 0;
    for (int i = 0; i < spinner.getCount(); i++) {
        if (spinner.getItemAtPosition(i).equals(s)) {
            index = i;/*from w w  w  .j  a v  a2 s . c  o  m*/
        }
    }
    return index;
}

From source file:uk.org.freeflight.wifefinder.MainActivity.java

void setSpinnerItemById(Spinner spinner, long _id) {
    int spinnerCount = spinner.getCount();
    for (int i = 0; i < spinnerCount; i++) {
        Cursor value = (Cursor) spinner.getItemAtPosition(i);
        long id = value.getLong(value.getColumnIndex("_id"));
        if (id == _id) {
            spinner.setSelection(i);// ww  w.ja va  2 s .co m
        }
    }
}