use of android.widget.ArrayAdapter in project FadingActionBar by ManuelPeinado.
the class ListViewActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FadingActionBarHelper helper = new FadingActionBarHelper().actionBarBackground(R.drawable.ab_background).headerLayout(R.layout.header).contentLayout(R.layout.activity_listview);
setContentView(helper.createView(this));
helper.initActionBar(this);
ListView listView = (ListView) findViewById(android.R.id.list);
ArrayList<String> items = loadItems(R.raw.nyc_sites);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, items);
listView.setAdapter(adapter);
}
use of android.widget.ArrayAdapter in project FadingActionBar by ManuelPeinado.
the class HeaderOverlayActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FadingActionBarHelper helper = new FadingActionBarHelper().actionBarBackground(R.drawable.ab_background).headerLayout(R.layout.header).contentLayout(R.layout.activity_listview).headerOverlayLayout(R.layout.header_overlay);
setContentView(helper.createView(this));
helper.initActionBar(this);
ListView listView = (ListView) findViewById(android.R.id.list);
ArrayList<String> items = loadItems(R.raw.nyc_sites);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, items);
listView.setAdapter(adapter);
}
use of android.widget.ArrayAdapter in project FadingActionBar by ManuelPeinado.
the class HeaderOverlayActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FadingActionBarHelper helper = new FadingActionBarHelper().actionBarBackground(R.drawable.ab_background).headerLayout(R.layout.header).contentLayout(R.layout.activity_listview).headerOverlayLayout(R.layout.header_overlay);
setContentView(helper.createView(this));
helper.initActionBar(this);
ListView listView = (ListView) findViewById(android.R.id.list);
ArrayList<String> items = loadItems(R.raw.nyc_sites);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, items);
listView.setAdapter(adapter);
}
use of android.widget.ArrayAdapter in project GT by Tencent.
the class GTInputParamSetActivity method initAutoCompleteTV.
private void initAutoCompleteTV(ArrayList<String> vals, final AutoCompleteTextView auto) {
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.gt_drop_default_listitem, vals);
auto.setDropDownBackgroundResource(R.drawable.btn_gray);
auto.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
auto.showDropDown();
}
});
auto.setText(vals.get(0));
auto.setSelection(vals.get(0).length());
auto.setAdapter(adapter);
auto.setThreshold(1);
auto.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (auto.getText().toString().equals("")) {
btn_c.setVisibility(View.GONE);
} else {
btn_c.setVisibility(View.VISIBLE);
}
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void afterTextChanged(Editable s) {
}
});
auto.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
auto.showDropDown();
}
});
}
use of android.widget.ArrayAdapter in project GT by Tencent.
the class SMActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.pi_othersm);
Button buttonCheckStatus = (Button) findViewById(R.id.buttonCheckStatus);
buttonCheckStatus.setOnClickListener(button_check_status);
Button buttonWriteProperty = (Button) findViewById(R.id.buttonWriteProperty);
buttonWriteProperty.setOnClickListener(button_write_property);
Button buttonRecoverProperty = (Button) findViewById(R.id.buttonRecoverProperty);
buttonRecoverProperty.setOnClickListener(button_recover_property);
Button buttonRestart = (Button) findViewById(R.id.buttonRestart);
buttonRestart.setOnClickListener(button_restart);
tv_switch = (TextView) findViewById(R.id.sample_switch);
if (SMServiceHelper.getInstance().isStarted()) {
tv_switch.setBackgroundResource(R.drawable.switch_off_border);
tv_switch.setText(getString(R.string.stop));
} else {
tv_switch.setBackgroundResource(R.drawable.switch_on_border);
tv_switch.setText(getString(R.string.start));
}
tv_switch.setOnClickListener(onStartClick);
TextView tv_back = (TextView) findViewById(R.id.back_gt);
tv_back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
listview = (ListView) findViewById(R.id.listViewOtherSM);
listview.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
ArrayList<String> datas = getData();
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_single_choice, datas);
listview.setAdapter(adapter);
if (datas != null && selectedItem != null) {
int position = datas.indexOf(selectedItem);
if (position >= 0) {
listview.setItemChecked(position, true);
}
}
listview.setOnItemClickListener(listview_listener);
SMServiceHelper.getInstance().addListener(this);
}
Aggregations