Example usage for android.widget ArrayAdapter ArrayAdapter

List of usage examples for android.widget ArrayAdapter ArrayAdapter

Introduction

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

Prototype

public ArrayAdapter(@NonNull Context context, @LayoutRes int resource, @NonNull List<T> objects) 

Source Link

Document

Constructor

Usage

From source file:com.hybris.mobile.app.commerce.fragment.AccountFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_account, container, false);

    mAccountEmailTextview = (TextView) view.findViewById(R.id.account_email_textview);
    mAccountFirstNameEditText = (EditText) view.findViewById(R.id.account_firstname_edittext);
    mAccountLastNameEditText = (EditText) view.findViewById(R.id.account_lastname_edittext);

    mAccountDefaultShippingAddressContact = (TextView) view
            .findViewById(R.id.account_default_shipping_address_contact);
    mAccountDefaultShippingAddressDetails = (TextView) view
            .findViewById(R.id.account_default_shipping_address_details);
    mAccountShippingAddressLayout = (LinearLayout) view.findViewById(R.id.account_shipping_address_layout);

    accountDefaultPaymentCardholderName = (TextView) view
            .findViewById(R.id.account_default_payment_cardholder_name);
    accountDefaultBillingAddress = (TextView) view.findViewById(R.id.account_default_billing_address);
    accountDefaultCardDetails = (TextView) view.findViewById(R.id.account_default_card_details);
    mAccountPaymentLayout = (LinearLayout) view.findViewById(R.id.account_payment_layout);

    mAccountUserTitleSpinner = (Spinner) view.findViewById(R.id.account_user_title_spinner);
    mAccountLanguageSpinner = (Spinner) view.findViewById(R.id.account_language_spinner);

    mAccountUserTitleAdapter = new ArrayAdapter<String>(getActivity(),
            android.R.layout.simple_spinner_dropdown_item, new ArrayList<String>());

    mAccountLanguageAdapter = new ArrayAdapter<String>(getActivity(),
            android.R.layout.simple_spinner_dropdown_item, new ArrayList<String>());

    mAccountFirstNameEditText.setOnFocusChangeListener(mOnFocusChangeListener);
    mAccountLastNameEditText.setOnFocusChangeListener(mOnFocusChangeListener);

    mAccountLanguageSpinner.setOnItemSelectedListener(mAccountSpinnerListener);
    mAccountUserTitleSpinner.setOnItemSelectedListener(mAccountSpinnerListener);

    mAccountShippingAddressLayout.setOnClickListener(mAccountDefaultAddressOnClickListener);
    mAccountPaymentLayout.setOnClickListener(mAccountDefaultPaymentOnClickListener);

    mAccountFirstNameEditText.setOnEditorActionListener(mOnEditorActionListener);
    mAccountLastNameEditText.setOnEditorActionListener(mOnEditorActionListener);

    return view;// w  w w . ja  v  a  2 s . co m
}

From source file:com.mifos.mifosxdroid.dialogfragments.LoanChargeDialogFragment.java

private void inflateChargesSpinner() {
    showProgress(true);/* w  ww . jav a  2 s.  c  o  m*/
    App.apiManager.getAllChargesV3(loanAccountNumber, new Callback<Response>() {

        @Override
        public void success(final Response result, Response response) {
            /* Activity is null - Fragment has been detached; no need to do anything. */
            if (getActivity() == null)
                return;

            Log.d(LOG_TAG, "");

            final List<Charges> charges = new ArrayList<>();
            // you can use this array to populate your spinner
            final ArrayList<String> chargesNames = new ArrayList<String>();
            //Try to get response body
            BufferedReader reader = null;
            StringBuilder sb = new StringBuilder();
            try {
                reader = new BufferedReader(new InputStreamReader(result.getBody().in()));
                String line;
                while ((line = reader.readLine()) != null) {
                    sb.append(line);
                }
                JSONObject obj = new JSONObject(sb.toString());
                if (obj.has("chargeOptions")) {
                    JSONArray chargesTypes = obj.getJSONArray("chargeOptions");
                    for (int i = 0; i < chargesTypes.length(); i++) {
                        JSONObject chargesObject = chargesTypes.getJSONObject(i);
                        Charges charge = new Charges();
                        charge.setId(chargesObject.optInt("id"));
                        charge.setName(chargesObject.optString("name"));
                        charges.add(charge);
                        chargesNames.add(chargesObject.optString("name"));
                        chargeNameIdHashMap.put(charge.getName(), charge.getId());
                    }

                }
                String stringResult = sb.toString();
            } catch (Exception e) {
                Log.e(LOG_TAG, "", e);
            }
            final ArrayAdapter<String> chargesAdapter = new ArrayAdapter<String>(getActivity(),
                    android.R.layout.simple_spinner_item, chargesNames);
            chargesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
            sp_charge_name.setAdapter(chargesAdapter);
            sp_charge_name.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
                @Override
                public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
                    Id = chargeNameIdHashMap.get(chargesNames.get(i));
                    Log.d("chargesoptionss" + chargesNames.get(i), String.valueOf(Id));
                    if (Id != -1) {

                    } else {

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

                    }

                }

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

                }
            });

            showProgress(false);

        }

        @Override
        public void failure(RetrofitError retrofitError) {

            Log.d(LOG_TAG, retrofitError.getLocalizedMessage());

            showProgress(false);
        }
    });
}

From source file:ca.ualberta.cs.unter.view.DriverSearchRequestActivity.java

@Override
public void onStart() {
    super.onStart();
    driver = FileIOUtil.loadUserFromFile(getApplicationContext());
    searchRequestAdapter = new ArrayAdapter<>(this, R.layout.request_list_item, searchRequestList);
    searchRequestListView.setAdapter(searchRequestAdapter);
}

From source file:com.hypodiabetic.happ.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    activity = this;
    super.onCreate(savedInstanceState);
    Fabric.with(this, new Crashlytics());
    ins = this;// w w  w .j ava2s . c  o m
    PreferenceManager.setDefaultValues(this, R.xml.pref_aps, false); //Sets default APS Preferences if the user has not

    //xdrip start
    prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    checkEula();

    startService(new Intent(getApplicationContext(), DataCollectionService.class));

    PreferenceManager.setDefaultValues(this, R.xml.pref_general, false);
    PreferenceManager.setDefaultValues(this, R.xml.pref_bg_notification, false);
    //xdrip end

    setContentView(R.layout.activity_main);
    extendedGraphBuilder = new ExtendedGraphBuilder(this);

    //Setup menu
    tickWhite = getDrawable(R.drawable.checkbox_marked_circle);
    clockWhite = getDrawable(R.drawable.clock);
    tickWhite.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_ATOP);
    clockWhite.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_ATOP);

    insulinIntegrationApp_status = (TextView) findViewById(R.id.insulinIntegrationApp_status);
    insulinIntegrationApp_icon = (ImageView) findViewById(R.id.insulinIntegrationApp_icon);
    mDrawerList = (ListView) findViewById(R.id.navList);
    String[] osArray = { "Cancel Temp", "Settings", "Integration Report" };
    mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, osArray);
    mDrawerList.setAdapter(mAdapter);
    mDrawerList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            switch (position) {
            case 0:
                pumpAction.cancelTempBasal(MainActivity.activity);
                break;
            case 1:
                startActivity(new Intent(getApplicationContext(), SettingsActivity.class));
                break;
            case 2:
                startActivity(new Intent(getApplicationContext(), Integration_Report.class));
                break;
            }
            mDrawerLayout.closeDrawers();
        }
    });
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerLinear = (LinearLayout) findViewById(R.id.left_drawer);
    mActivityTitle = getTitle().toString();
    mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.drawer_open,
            R.string.drawer_close) {
        /** Called when a drawer has settled in a completely open state. */
        public void onDrawerOpened(View drawerView) {
            super.onDrawerOpened(drawerView);
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
            SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(MainActivity.getInstace());
            Date now = new Date();
            Profile p = new Profile(now, MainActivity.getInstace());
            //Local device based Integrations
            String insulin_Integration_App = prefs.getString("insulin_integration", "");

            //Insulin Integration App, try and connect
            if (!insulin_Integration_App.equals("")) {
                InsulinIntegrationApp insulinIntegrationApp = new InsulinIntegrationApp(
                        MainActivity.getInstace(), insulin_Integration_App, "TEST");
                insulinIntegrationApp.connectInsulinTreatmentApp();
                insulinIntegrationApp_status.setText("Connecting...");
                insulinIntegrationApp_icon.setBackground(clockWhite);

                //listens out for connection
                insulinIntegrationAppUpdate = new BroadcastReceiver() {
                    @Override
                    public void onReceive(Context context, Intent intent) {
                        insulinIntegrationApp_status.setText(intent.getStringExtra("MSG"));
                        insulinIntegrationApp_icon.setBackground(tickWhite);

                    }
                };
                LocalBroadcastManager.getInstance(MainActivity.getInstace()).registerReceiver(
                        insulinIntegrationAppUpdate, new IntentFilter("INSULIN_INTEGRATION_TEST"));
            } else {
                insulinIntegrationApp_status.setText("No app selected or not in Closed Loop");
                insulinIntegrationApp_icon.setBackgroundResource(R.drawable.alert_circle);
            }
        }

        /** Called when a drawer has settled in a completely closed state. */
        public void onDrawerClosed(View view) {
            super.onDrawerClosed(view);
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
        }
    };

    toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);
    mDrawerToggle.syncState();
    mDrawerToggle.setDrawerIndicatorEnabled(true);
    mDrawerLayout.setDrawerListener(mDrawerToggle);

    // Create the adapter that will return a fragment for each of the 4 primary sections of the app.
    mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
    // Set up the ViewPager with the sections adapter.
    mViewPager = (ViewPager) this.findViewById(R.id.pager);
    mViewPager.setAdapter(mSectionsPagerAdapter);
    //mViewPager.setOffscreenPageLimit(4);                                                        //Do not destroy any Fragments, // TODO: 14/09/2015 casues an issue with bvb chart rendering, not sure why
    //Build Fragments
    openAPSFragmentObject = new openAPSFragment();
    iobcobActiveFragmentObject = new iobcobActiveFragment();
    iobcobFragmentObject = new iobcobFragment();
    basalvsTempBasalObject = new basalvsTempBasalFragment();

    //Updates notifications every 60 seconds
    updateEvery60Seconds = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            APSResult apsResult = APSResult.last();
            Notifications.updateCard(context, apsResult);
        }
    };
    registerReceiver(updateEvery60Seconds, new IntentFilter(Intent.ACTION_TIME_TICK));

}

From source file:com.krayzk9s.imgurholo.ui.AccountFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    Log.d("Username", username);
    ImgurHoloActivity activity = (ImgurHoloActivity) getActivity();
    SharedPreferences settings = activity.getApiCall().settings;
    Log.d("SettingTitle", username);
    View view = inflater.inflate(R.layout.account_layout, container, false);
    mPullToRefreshLayout = (PullToRefreshLayout) view.findViewById(R.id.ptr_layout);
    ActionBarPullToRefresh.from(getActivity())
            // Mark All Children as pullable
            .allChildrenArePullable()/*from ww w. ja  v a 2  s. co m*/
            // Set the OnRefreshListener
            .listener(this)
            // Finally commit the setup to our PullToRefreshLayout
            .setup(mPullToRefreshLayout);
    LinearLayout header = (LinearLayout) view.findViewById(R.id.header);
    if (settings.getString("theme", MainActivity.HOLO_LIGHT).equals(MainActivity.HOLO_LIGHT))
        header.setBackgroundColor(0xFFCCCCCC);
    biography = (TextView) view.findViewById(R.id.biography);
    TextView usernameText = (TextView) view.findViewById(R.id.username);
    usernameText.setText(username);
    created = (TextView) view.findViewById(R.id.created);
    reputation = (TextView) view.findViewById(R.id.reputation);
    mDrawerList = (ListView) view.findViewById(R.id.account_list);
    mMenuList = getResources().getStringArray(R.array.accountMenu);
    adapter = new ArrayAdapter<String>(view.getContext(), R.layout.drawer_list_item, mMenuList);
    mDrawerList.setAdapter(adapter);
    mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
    if (savedInstanceState == null) {
        getAccount();
    }
    return view;
}

From source file:oss.ridendivideapp.PlacesAutoCompleteActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    try {//from   w w  w.j  a  v  a  2 s  .c o  m

        super.onCreate(savedInstanceState);
        setContentView(R.layout.give_ride_content);
        /* Creating DBAdapter instance */
        gr_datasource = new DBAdapter(this);

        /* Get email ID from previous activity to maintain session */
        Bundle extras = getIntent().getExtras();
        if (extras != null) {
            str_usrid = extras.getString("usrid");
        }

        buttonSubmit = (Button) findViewById(R.id.btn_gr_submit);
        buttonCancel = (Button) findViewById(R.id.btn_gr_cancel);
        /* Get radius and cost */
        et_radius = (EditText) this.findViewById(R.id.txt_gr_radius);
        et_cost = (EditText) this.findViewById(R.id.txt_gr_cost);

        /* Adding PlacesAutoComplete adapter to the FROM autocomplete field */
        gr_frm_acView = (AutoCompleteTextView) findViewById(R.id.txt_gr_from);
        gr_frm_adapter = new PlacesAutoCompleteAdapter(this, R.layout.frm_item_list);
        gr_frm_acView.setAdapter(gr_frm_adapter);
        gr_frm_acView.setOnItemClickListener(this);

        /* Adding PlacesAutoComplete adapter to the TO autocomplete field */
        gr_to_acView = (AutoCompleteTextView) findViewById(R.id.txt_gr_to);
        gr_to_adapter = new PlacesAutoCompleteAdapter(this, R.layout.to_item_list);
        gr_to_acView.setAdapter(gr_to_adapter);
        gr_to_acView.setOnItemClickListener(this);

        /* Adding array adapter to spinner control for seats */
        sp_seats = (Spinner) findViewById(R.id.spn_gr_seats);
        ArrayAdapter<String> seats_adapter = new ArrayAdapter<String>(this,
                android.R.layout.simple_spinner_item, str_seats);
        sp_seats.setAdapter(seats_adapter);

        /* Prompt a dialog box upon Date button click */
        datePicker = (Button) findViewById(R.id.btn_gr_datepicker);
        datePicker.setText(dateFormatter.format(dateTime.getTime()));
        datePicker.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                showDialog(DIALOG_DATE);
            }
        });

        /* Prompt a dialog box upon Time button click */
        timePicker = (Button) findViewById(R.id.btn_gr_timepicker);
        timePicker.setText(timeFormatter.format(dateTime.getTime()));
        timePicker.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {
                showDialog(DIALOG_TIME);
            }
        });

        buttonSubmit.setOnClickListener(buttonSubmitOnClickListener);
        buttonCancel.setOnClickListener(buttonCancelOnClickListener);
        sp_seats.setOnItemSelectedListener(spinnerseatsOnItemSelectedListener);
    } catch (Exception e) {
        Log.e("Places AutoComplete Activity OnCreate:", e.toString());
    }

}

From source file:app.philm.in.fragments.LoginFragment.java

@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
    switch (checkedId) {
    case R.id.rb_login:
        mLoginButton.setText(R.string.account_login);
        mEmailAutoComplete.setVisibility(View.GONE);
        break;/* w  ww  .j  a v  a  2  s .co  m*/
    case R.id.rb_create:
        mLoginButton.setText(R.string.account_register);
        mEmailAutoComplete.setVisibility(View.VISIBLE);

        if (mEmailAutoComplete.getAdapter() == null) {
            final Set<String> emailSet = new HashSet<>();
            for (Account account : AccountManager.get(getActivity()).getAccounts()) {
                if (Patterns.EMAIL_ADDRESS.matcher(account.name).matches()) {
                    emailSet.add(account.name);
                }
            }
            List<String> emails = new ArrayList<>(emailSet);
            mEmailAutoComplete.setAdapter(
                    new ArrayAdapter<>(getActivity(), android.R.layout.simple_spinner_dropdown_item, emails));
        }
        break;
    }
}

From source file:info.hl.mediam.MyProfileActivity.java

private void Initialization() {

    if (MediamApp.hasNetworkConnection()) {
        getLoginUserData();/*from ww w  . ja v  a 2 s  .c o m*/
    }

    mSvProfile = (ScrollView) findViewById(R.id.svProfile);
    mRlEditControls = (RelativeLayout) findViewById(R.id.rlEditControls);
    mRlBirthday = (RelativeLayout) findViewById(R.id.rlBirthday);
    mRlAbout = (RelativeLayout) findViewById(R.id.rlAbout);
    mRlGender = (RelativeLayout) findViewById(R.id.rlGender);
    mRlEmail = (RelativeLayout) findViewById(R.id.rlEmail);
    mRlOnlineStatus = (RelativeLayout) findViewById(R.id.rlOnlineStatus);
    mIvProfileImage = (ImageView) findViewById(R.id.ivProfileImage);
    mPbLoading = (ProgressBar) findViewById(R.id.pbLoadingForImage);
    mBtnEdit = (Button) findViewById(R.id.btnEdit);
    mBtnEdit.setTypeface(MediamApp.getTfMyriadProBold(), Typeface.BOLD);
    mBtnSave = (Button) findViewById(R.id.btnSave);
    mBtnSave.setTypeface(MediamApp.getTfMyriadProBold(), Typeface.BOLD);
    mTvUserName = (TextView) findViewById(R.id.tvUserName);
    mEtUserName = (EditText) findViewById(R.id.etUserName);
    mEtUserName.setTypeface(MediamApp.getTfMyriadPro());
    mEtUserEmail = (EditText) findViewById(R.id.etUserEmail);
    mEtUserEmail.setTypeface(MediamApp.getTfMyriadPro());
    mEtUserEmail.setInputType(InputType.TYPE_NULL);

    mSpinnerGender = (Spinner) findViewById(R.id.spinnerGender);
    final ArrayAdapter<String> genderAdapter = new ArrayAdapter<String>(this,
            android.R.layout.simple_spinner_item, getResources().getStringArray(R.array.gender)) {

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            View v = super.getView(position, convertView, parent);
            ((TextView) v).setTextSize(16);
            ((TextView) v).setTypeface(MediamApp.getTfMyriadPro());
            if (position == 2) {
                ((TextView) v).setTextColor(getResources().getColor(R.color.light_gray_subtext));
                ((TextView) v).setText(getResources().getString(R.string.tap_to_add_gender));
            } else {
                ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive));
            }
            return v;
        }

        @Override
        public View getDropDownView(int position, View convertView, ViewGroup parent) {
            View v = super.getDropDownView(position, convertView, parent);
            ((TextView) v).setTextSize(20);
            ((TextView) v).setTypeface(MediamApp.getTfMyriadPro());
            ((TextView) v).setPadding(15, 15, 15, 15);
            if (position == 2) {
                ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_neutral));
            } else {
                ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive));
            }
            return v;
        }
    };
    mSpinnerGender.setAdapter(genderAdapter);
    mSpinnerGender.setOnItemSelectedListener(new OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            switch (arg2) {
            case 0:
                mNewGender = Const.MALE;
                break;
            case 1:
                mNewGender = Const.FEMALE;
                break;
            case 2:
                mNewGender = null;
                break;
            default:
                break;
            }

        }

        @Override
        public void onNothingSelected(AdapterView<?> arg0) {
            // TODO Auto-generated method stub

        }
    });

    mSpinnerStatus = (Spinner) findViewById(R.id.spinnerStatus);
    final ArrayAdapter<String> onlineStatusAdapter = new ArrayAdapter<String>(this,
            android.R.layout.simple_spinner_item, getResources().getStringArray(R.array.online_status)) {
        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            View v = super.getView(position, convertView, parent);
            ((TextView) v).setTextSize(16);
            ((TextView) v).setTypeface(MediamApp.getTfMyriadPro());

            Drawable statusIcon = null;

            switch (position) {
            case 0:
                statusIcon = getContext().getResources().getDrawable(R.drawable.user_online_icon);
                ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive));
                break;
            case 1:
                statusIcon = getContext().getResources().getDrawable(R.drawable.user_away_icon);
                ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive));
                break;
            case 2:
                statusIcon = getContext().getResources().getDrawable(R.drawable.user_busy_icon);
                ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive));
                break;
            case 3:
                statusIcon = getContext().getResources().getDrawable(R.drawable.user_offline_icon);
                ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive));
                break;
            default:
                ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive));
                break;
            }

            ((TextView) v).setCompoundDrawablePadding(10);
            ((TextView) v).setCompoundDrawablesWithIntrinsicBounds(statusIcon, null, null, null);

            return v;
        }

        @Override
        public View getDropDownView(int position, View convertView, ViewGroup parent) {
            View v = super.getDropDownView(position, convertView, parent);
            ((TextView) v).setTextSize(20);
            ((TextView) v).setTypeface(MediamApp.getTfMyriadPro());
            ((TextView) v).setPadding(15, 15, 15, 15);
            Drawable statusIcon = null;

            switch (position) {
            case 0:
                statusIcon = getContext().getResources().getDrawable(R.drawable.user_online_icon);
                ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive));
                break;
            case 1:
                statusIcon = getContext().getResources().getDrawable(R.drawable.user_away_icon);
                ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive));
                break;
            case 2:
                statusIcon = getContext().getResources().getDrawable(R.drawable.user_busy_icon);
                ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive));
                break;
            case 3:
                statusIcon = getContext().getResources().getDrawable(R.drawable.user_offline_icon);
                ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive));
                break;
            default:
                ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive));
                break;
            }

            ((TextView) v).setCompoundDrawablePadding(10);
            ((TextView) v).setCompoundDrawablesWithIntrinsicBounds(statusIcon, null, null, null);
            return v;
        }
    };
    mSpinnerStatus.setAdapter(onlineStatusAdapter);
    mSpinnerStatus.setOnItemSelectedListener(new OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            switch (arg2) {
            case 0:
                mNewOnlineStatus = Const.ONLINE;
                break;
            case 1:
                mNewOnlineStatus = Const.AWAY;
                break;
            case 2:
                mNewOnlineStatus = Const.BUSY;
                break;
            case 3:
                mNewOnlineStatus = Const.OFFLINE;
                break;
            default:
                break;
            }

        }

        @Override
        public void onNothingSelected(AdapterView<?> arg0) {
            // TODO Auto-generated method stub

        }
    });

    mEtUserPassword = (EditText) findViewById(R.id.etUserPassword);
    mEtUserPassword.setTypeface(MediamApp.getTfMyriadPro());

    mEtUserAbout = (EditText) findViewById(R.id.etUserAbout);
    mEtUserAbout.setTypeface(MediamApp.getTfMyriadPro());
    mEtUserBirthday = (EditText) findViewById(R.id.etUserBirthday);
    mEtUserBirthday.setTypeface(MediamApp.getTfMyriadPro());

    setProfileMode(ProfileMode.CANCEL);

}

From source file:com.BreakingBytes.SifterReader.SifterReader.java

/** Method to pass project names to list adapter. */
private void fillData() {
    int pNum = mAllProjects.length;
    String[] p = new String[pNum];
    try {//from   w w  w  .j a v  a  2s . co m
        for (int j = 0; j < pNum; j++)
            p[j] = mAllProjects[j].getString(PROJECT_NAME);
    } catch (JSONException e) {
        e.printStackTrace();
        mSifterHelper.onException(e.toString());
        return;
    }
    setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, p));
}

From source file:com.audiokernel.euphonyrmt.MainMenuActivity.java

private ListView initializeDrawerList() {
    final ListView drawerList = (ListView) findViewById(R.id.left_drawer);
    final DrawerItem[] drawerItems = {
            new DrawerItem(getString(R.string.libraryTabActivity), DrawerItem.Action.ACTION_LIBRARY),

            new DrawerItem(getString(R.string.outputs), DrawerItem.Action.ACTION_OUTPUTS),

            new DrawerItem(getString(R.string.settings), DrawerItem.Action.ACTION_SETTINGS),
            new DrawerItem("Euphony Settings...", DrawerItem.Action.ACTION_LOON_CLIENT),
            new DrawerItem("Euphony File Manager...", DrawerItem.Action.ACTION_LOON_FM),
            new DrawerItem("Euphony Reboot", DrawerItem.Action.ACTION_LOON_REBOOT),
            new DrawerItem("Euphony Shutdown", DrawerItem.Action.ACTION_LOON_SHUTDOWN) };

    // Set the adapter for the list view
    drawerList.setAdapter(new ArrayAdapter<>(this, R.layout.drawer_list_item, drawerItems));
    drawerList.setItemChecked(mOldDrawerPosition, true);

    // Set the list's click listener
    drawerList.setOnItemClickListener(new DrawerItemClickListener());

    return drawerList;
}