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(android.R.id.list);
      list.setAdapter(new ArrayAdapter<String>(this,
              android.R.layout.simple_list_item_single_choice, listItems));
      list.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
      list.setItemsCanFocus(false);
      list.setOnItemClickListener(
              new AdapterView.OnItemClickListener() {
                  @Override 
                  public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
                      mSelectedItemIndex = position;
                      mOkButton.setEnabled(true);
                  } 
              }); 
      if (mSelectedItemIndex != SELECTED_ITEM_NONE) {
          list.setItemChecked(mSelectedItemIndex, true);
          if (Log.isLoggable(TAG, Log.VERBOSE)) {

7
CodeRank
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(R.menu.tutorial_standard, menu);
        return true; 
    } 
 
    private void setupActionBar() { 
        mList.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
        mList.setItemsCanFocus(false);
    } 
 
    @Override 
    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
6
CodeRank
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: