Search in sources :

Example 66 with ArrayAdapter

use of android.widget.ArrayAdapter in project cw-android by commonsguy.

the class SpinnerDemo method onCreate.

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.main);
    selection = (TextView) findViewById(R.id.selection);
    Spinner spin = (Spinner) findViewById(R.id.spinner);
    spin.setOnItemSelectedListener(this);
    ArrayAdapter<String> aa = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, items);
    aa.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spin.setAdapter(aa);
}
Also used : Spinner(android.widget.Spinner) ArrayAdapter(android.widget.ArrayAdapter)

Example 67 with ArrayAdapter

use of android.widget.ArrayAdapter in project FlexibleAdapter by davideas.

the class BottomSheetDialog method createPopUps.

private void createPopUps() {
    //Create the Adapter
    if (mAdapterReference == null) {
        mAdapterItemType = new ArrayAdapter(getContext(), R.layout.reference_spinner_item, new String[] { "Simple Item", "Expandable", "Expandable Section", "Section" });
        mAdapterReference = new ArrayAdapter(getContext(), R.layout.reference_spinner_item, getListener().getReferenceList());
    }
    //Setting up the popups
    Log.d(TAG, "Setting up the Popups");
    //Item Type
    mPopupItemType = new ListPopupWindow(getContext());
    mPopupItemType.setAnchorView(mBottomSheetDialog.findViewById(R.id.select_item_type));
    mPopupItemType.setModal(true);
    mPopupItemType.setInputMethodMode(ListPopupWindow.INPUT_METHOD_NOT_NEEDED);
    mPopupItemType.setAnimationStyle(android.R.style.Animation_Dialog);
    mPopupItemType.setAdapter(mAdapterItemType);
    mPopupItemType.setVerticalOffset(-100);
    //Header Reference
    mPopupReference = new ListPopupWindow(getContext());
    mPopupReference.setAnchorView(mBottomSheetDialog.findViewById(R.id.select_reference_button));
    mPopupReference.setModal(true);
    mPopupReference.setInputMethodMode(ListPopupWindow.INPUT_METHOD_NOT_NEEDED);
    mPopupReference.setAnimationStyle(android.R.style.Animation_Dialog);
    mPopupReference.setAdapter(mAdapterReference);
    mPopupReference.setVerticalOffset(-100);
    if (mAdapterReference.getCount() > 6)
        mPopupReference.setHeight(getResources().getDimensionPixelSize(R.dimen.popup_max_height));
}
Also used : ListPopupWindow(android.widget.ListPopupWindow) ArrayAdapter(android.widget.ArrayAdapter)

Example 68 with ArrayAdapter

use of android.widget.ArrayAdapter in project UltimateAndroid by cymcsg.

the class SnackbarListViewSampleActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.snack_bar_activity_list_sample);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    final ListView listView = (ListView) findViewById(android.R.id.list);
    List<String> data = new ArrayList<String>();
    for (int i = 0; i < 25; i++) {
        data.add(String.format("Item %d", (i + 1)));
    }
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, data);
    listView.setAdapter(adapter);
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            SnackbarManager.show(Snackbar.with(SnackbarListViewSampleActivity.this).text(String.format("Item %d pressed", (position + 1))).actionLabel("Close").actionColor(Color.parseColor("#FF8A80")).duration(Snackbar.SnackbarDuration.LENGTH_LONG).attachToAbsListView(listView));
        }
    });
}
Also used : ArrayList(java.util.ArrayList) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) ListView(android.widget.ListView) AdapterView(android.widget.AdapterView) ArrayAdapter(android.widget.ArrayAdapter)

Example 69 with ArrayAdapter

use of android.widget.ArrayAdapter in project snackbar by nispok.

the class SnackbarListViewSampleActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_list_sample);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    final ListView listView = (ListView) findViewById(android.R.id.list);
    List<String> data = new ArrayList<String>();
    for (int i = 0; i < 25; i++) {
        data.add(String.format("Item %d", (i + 1)));
    }
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, data);
    listView.setAdapter(adapter);
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            SnackbarManager.show(Snackbar.with(SnackbarListViewSampleActivity.this).text(String.format("Item %d pressed", (position + 1))).actionLabel("Close").actionColor(Color.parseColor("#FF8A80")).duration(Snackbar.SnackbarDuration.LENGTH_LONG).attachToAbsListView(listView));
        }
    });
}
Also used : ArrayList(java.util.ArrayList) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) ListView(android.widget.ListView) AdapterView(android.widget.AdapterView) ArrayAdapter(android.widget.ArrayAdapter)

Example 70 with ArrayAdapter

use of android.widget.ArrayAdapter in project dialogplus by orhanobut.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.activity_toolbar);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    actionBar.setTitle(getString(R.string.app_name));
    radioGroup = (RadioGroup) findViewById(R.id.radio_group);
    headerCheckBox = (CheckBox) findViewById(R.id.header_check_box);
    footerCheckBox = (CheckBox) findViewById(R.id.footer_check_box);
    expandedCheckBox = (CheckBox) findViewById(R.id.expanded_check_box);
    findViewById(R.id.button_bottom).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            showDialog(radioGroup.getCheckedRadioButtonId(), Gravity.BOTTOM, headerCheckBox.isChecked(), footerCheckBox.isChecked(), expandedCheckBox.isChecked());
        }
    });
    findViewById(R.id.button_center).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            showDialog(radioGroup.getCheckedRadioButtonId(), Gravity.CENTER, headerCheckBox.isChecked(), footerCheckBox.isChecked(), expandedCheckBox.isChecked());
        }
    });
    findViewById(R.id.button_top).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            showDialog(radioGroup.getCheckedRadioButtonId(), Gravity.TOP, headerCheckBox.isChecked(), footerCheckBox.isChecked(), expandedCheckBox.isChecked());
        }
    });
    View contentView = getLayoutInflater().inflate(R.layout.content2, null);
    DialogPlus dialogPlus = DialogPlus.newDialog(this).setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, new String[] { "asdfa" })).setCancelable(true).setOnDismissListener(new OnDismissListener() {

        @Override
        public void onDismiss(DialogPlus dialog) {
        }
    }).setOnCancelListener(new OnCancelListener() {

        @Override
        public void onCancel(DialogPlus dialog) {
        }
    }).setOnBackPressListener(new OnBackPressListener() {

        @Override
        public void onBackPressed(DialogPlus dialogPlus) {
        }
    }).create();
    dialogPlus.show();
}
Also used : DialogPlus(com.orhanobut.dialogplus.DialogPlus) OnDismissListener(com.orhanobut.dialogplus.OnDismissListener) TextView(android.widget.TextView) View(android.view.View) OnBackPressListener(com.orhanobut.dialogplus.OnBackPressListener) ActionBar(android.support.v7.app.ActionBar) ArrayAdapter(android.widget.ArrayAdapter) Toolbar(android.support.v7.widget.Toolbar) OnCancelListener(com.orhanobut.dialogplus.OnCancelListener)

Aggregations

ArrayAdapter (android.widget.ArrayAdapter)309 View (android.view.View)154 TextView (android.widget.TextView)102 ListView (android.widget.ListView)92 AdapterView (android.widget.AdapterView)89 ArrayList (java.util.ArrayList)55 Spinner (android.widget.Spinner)51 ViewGroup (android.view.ViewGroup)40 Intent (android.content.Intent)33 AutoCompleteTextView (android.widget.AutoCompleteTextView)29 Button (android.widget.Button)26 ImageView (android.widget.ImageView)26 DialogInterface (android.content.DialogInterface)23 ListAdapter (android.widget.ListAdapter)21 RecyclerView (android.support.v7.widget.RecyclerView)18 LayoutInflater (android.view.LayoutInflater)18 LinearLayout (android.widget.LinearLayout)18 Bundle (android.os.Bundle)17 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)17 EditText (android.widget.EditText)15