Search in sources :

Example 51 with ArrayAdapter

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);
}
Also used : FadingActionBarHelper(com.manuelpeinado.fadingactionbar.extras.actionbarcompat.FadingActionBarHelper) ListView(android.widget.ListView) ArrayAdapter(android.widget.ArrayAdapter)

Example 52 with ArrayAdapter

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);
}
Also used : FadingActionBarHelper(com.manuelpeinado.fadingactionbar.FadingActionBarHelper) ListView(android.widget.ListView) ArrayAdapter(android.widget.ArrayAdapter)

Example 53 with ArrayAdapter

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);
}
Also used : FadingActionBarHelper(com.manuelpeinado.fadingactionbar.extras.actionbarcompat.FadingActionBarHelper) ListView(android.widget.ListView) ArrayAdapter(android.widget.ArrayAdapter)

Example 54 with ArrayAdapter

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();
        }
    });
}
Also used : OnFocusChangeListener(android.view.View.OnFocusChangeListener) OnClickListener(android.view.View.OnClickListener) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) AutoCompleteTextView(android.widget.AutoCompleteTextView) TextView(android.widget.TextView) View(android.view.View) ArrayAdapter(android.widget.ArrayAdapter)

Example 55 with ArrayAdapter

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);
}
Also used : Button(android.widget.Button) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) ArrayAdapter(android.widget.ArrayAdapter)

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