use of android.widget.ArrayAdapter in project FBReaderJ by geometer.
the class Chooser method onStart.
@Override
protected void onStart() {
super.onStart();
setTitle(myResource.getValue());
final ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.background_chooser_item, R.id.background_chooser_item_title);
final ZLResource chooserResource = myResource.getResource("chooser");
adapter.add(chooserResource.getResource("solidColor").getValue());
adapter.add(chooserResource.getResource("predefined").getValue());
adapter.add(chooserResource.getResource("selectFile").getValue());
setListAdapter(adapter);
getListView().setOnItemClickListener(this);
}
use of android.widget.ArrayAdapter in project coursera-android by aporter.
the class AutoCompleteActivity method onCreate.
/** Called when the activity is first created. */
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Get a reference to the AutoCompleteTextView
AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.autocomplete_country);
// Create an ArrayAdapter containing country names
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.list_item, COUNTRIES);
// Set the adapter for the AutoCompleteTextView
textView.setAdapter(adapter);
textView.setOnItemClickListener(new OnItemClickListener() {
// Display a Toast Message when the user clicks on an item in the AutoCompleteTextView
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
Toast.makeText(getApplicationContext(), "The winner is:" + arg0.getAdapter().getItem(arg2), Toast.LENGTH_SHORT).show();
}
});
}
use of android.widget.ArrayAdapter in project cardslib by gabrielemariotti.
the class MainActivity method _initMenu.
private void _initMenu() {
mDrawerList = (ListView) findViewById(R.id.drawer);
if (mDrawerList != null) {
ArrayAdapter<String> mAdapter = new ArrayAdapter<String>(this, R.layout.demo_activity_menuitem, options);
List<SimpleSectionedListAdapter.Section> sections = new ArrayList<SimpleSectionedListAdapter.Section>();
sections.add(new SimpleSectionedListAdapter.Section(CASE_STD, "Card base features"));
sections.add(new SimpleSectionedListAdapter.Section(CASE_BIRTH, "Card examples"));
sections.add(new SimpleSectionedListAdapter.Section(CASE_LIST_BASE, "List and Grid"));
sections.add(new SimpleSectionedListAdapter.Section(CASE_LIST_GPLAY_CAB, "Multichoice"));
sections.add(new SimpleSectionedListAdapter.Section(CASE_CARDWITHLIST, "Misc"));
SimpleSectionedListAdapter.Section[] dummy = new SimpleSectionedListAdapter.Section[sections.size()];
mSectionedAdapter = new SimpleSectionedListAdapter(this, R.layout.demo_activity_menusection, mAdapter);
mSectionedAdapter.setSections(sections.toArray(dummy));
mDrawerList.setAdapter(mSectionedAdapter);
mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
}
}
use of android.widget.ArrayAdapter in project AndroidSDK-RecipeBook by gabu.
the class Recipe052 method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
String[] data = { "Point", "Line", "Rect", "Circle", "Oval", "Arc", "Path" };
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, data);
mSpinner = (Spinner) findViewById(R.id.spinner);
mSpinner.setAdapter(adapter);
mSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
switch(position) {
case 0:
mCanvasView.setDrawMode(CanvasView.DRAW_POINT);
break;
case 1:
mCanvasView.setDrawMode(CanvasView.DRAW_LINE);
break;
case 2:
mCanvasView.setDrawMode(CanvasView.DRAW_RECT);
break;
case 3:
mCanvasView.setDrawMode(CanvasView.DRAW_CIRCLE);
break;
case 4:
mCanvasView.setDrawMode(CanvasView.DRAW_OVAL);
break;
case 5:
mCanvasView.setDrawMode(CanvasView.DRAW_ARC);
break;
case 6:
mCanvasView.setDrawMode(CanvasView.DRAW_PATH);
break;
}
mCanvasView.invalidate();
}
public void onNothingSelected(AdapterView<?> arg0) {
}
});
mCanvasView = (CanvasView) findViewById(R.id.canvas_view);
}
use of android.widget.ArrayAdapter in project facebook-android-sdk by facebook.
the class AccountKitLoginActivity method setupAdvancedUIOptions.
private void setupAdvancedUIOptions() {
advancedUISwitch = (Switch) findViewById(R.id.advanced_ui_switch);
final View advancedUIOptionsLayout = findViewById(R.id.advanced_ui_options);
final List<CharSequence> buttonNames = new ArrayList<>();
buttonNames.add("Default");
for (ButtonType buttonType : ButtonType.values()) {
buttonNames.add(buttonType.name());
}
final ArrayAdapter<CharSequence> buttonNameAdapter = new ArrayAdapter<>(AccountKitLoginActivity.this, android.R.layout.simple_spinner_dropdown_item, buttonNames);
advancedUISwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
if (isSkinSelected()) {
advancedUISwitch.setChecked(false);
Toast.makeText(AccountKitLoginActivity.this, R.string.skin_ui_required, Toast.LENGTH_LONG).show();
return;
}
advancedUIOptionsLayout.setVisibility(View.VISIBLE);
final Spinner entryButtonSpinner = (Spinner) findViewById(R.id.entry_button_spinner);
if (entryButtonSpinner != null) {
entryButtonSpinner.setAdapter(buttonNameAdapter);
entryButtonSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(final AdapterView<?> parent, final View view, final int position, final long id) {
// First position is empty, so anything past that
if (position > 0) {
entryButton = ButtonType.valueOf(entryButtonSpinner.getSelectedItem().toString());
} else {
entryButton = null;
}
}
@Override
public void onNothingSelected(final AdapterView<?> parent) {
entryButton = null;
}
});
}
final Spinner confirmButtonSpinner = (Spinner) findViewById(R.id.confirm_button_spinner);
if (confirmButtonSpinner != null) {
confirmButtonSpinner.setAdapter(buttonNameAdapter);
confirmButtonSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(final AdapterView<?> parent, final View view, final int position, final long id) {
// that
if (position > 0) {
confirmButton = ButtonType.valueOf(confirmButtonSpinner.getSelectedItem().toString());
} else {
confirmButton = null;
}
}
@Override
public void onNothingSelected(final AdapterView<?> parent) {
confirmButton = null;
}
});
}
final Spinner textPositionSpinner = (Spinner) findViewById(R.id.text_position_spinner);
if (textPositionSpinner != null) {
final List<CharSequence> textPositions = new ArrayList<>();
textPositions.add("Default");
for (TextPosition textPosition : TextPosition.values()) {
textPositions.add(textPosition.name());
}
final ArrayAdapter<CharSequence> textPositionAdapter = new ArrayAdapter<>(AccountKitLoginActivity.this, android.R.layout.simple_spinner_dropdown_item, textPositions);
textPositionSpinner.setAdapter(textPositionAdapter);
textPositionSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(final AdapterView<?> parent, final View view, final int position, final long id) {
// that
if (position > 0) {
textPosition = TextPosition.valueOf(textPositionSpinner.getSelectedItem().toString());
} else {
textPosition = null;
}
}
@Override
public void onNothingSelected(final AdapterView<?> parent) {
textPosition = null;
}
});
}
} else if (isReverbThemeSelected()) {
advancedUISwitch.setChecked(true);
Toast.makeText(AccountKitLoginActivity.this, R.string.reverb_advanced_ui_required, Toast.LENGTH_LONG).show();
} else {
advancedUIOptionsLayout.setVisibility(View.GONE);
}
}
});
}
Aggregations