Best code examples for ListView setItemsCanFocus method (android.widget.ListView.setItemsCanFocus)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for ListView setItemsCanFocus method.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

ListView setItemsCanFocus examples from Open Source projects
This code example shows how to use the following methods: setChoiceMode, setItemChecked, setAdapter, setItemsCanFocus, setOnItemClickListener
     * Populates the UI ListView with the given list of items and selects an item 
     * based on {@code mSelectedItemIndex} member variable. 
    private final void populateUIAccountList(String[] listItems) {
      ListView list = (ListView) findViewById(;
      list.setAdapter(new ArrayAdapter<String>(this,
              android.R.layout.simple_list_item_single_choice, listItems));
              new AdapterView.OnItemClickListener() {
                  public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
                      mSelectedItemIndex = position;
      if (mSelectedItemIndex != SELECTED_ITEM_NONE) {
          list.setItemChecked(mSelectedItemIndex, true);
          if (Log.isLoggable(TAG, Log.VERBOSE)) {

This code example shows how to use the following methods: setDescendantFocusability, setFastScrollEnabled, setSmoothScrollbarEnabled, setTranscriptMode, setAdapter
This code example shows how to use the following methods: setChoiceMode, setItemsCanFocus
        getSupportMenuInflater().inflate(, menu);
        return true; 
    private void setupActionBar() { 
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        String message = String.format("%s %s", (position + 1), this.getString(R.string.clicked));
        Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
Full Snippet Info
Related ListView setItemsCanFocus Questions & Answers:
setItemsCanFocus Method Overview
Indicates that the views created by the ListAdapter can contain focusable items.
See Code Examples for other Android ListView Methods: