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);
}
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));
}
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));
}
});
}
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));
}
});
}
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();
}
Aggregations