Example usage for android.widget ListView setItemChecked

List of usage examples for android.widget ListView setItemChecked

Introduction

In this page you can find the example usage for android.widget ListView setItemChecked.

Prototype

public void setItemChecked(int position, boolean value) 

Source Link

Document

Sets the checked state of the specified position.

Usage

From source file:com.laevatein.internal.ui.helper.AlbumListViewHelper.java

public static void setCheckedState(Fragment fragment, int position) {
    ListView listView = (ListView) FragmentUtils.findViewById(fragment, R.id.l_list_album);
    listView.setItemChecked(position, true);
}

From source file:org.odk.collect.android.fragments.AppListFragment.java

public static void setAllToCheckedState(ListView lv, boolean check) {
    // no-op if ListView null
    if (lv == null) {
        return;/*from  w w  w  .  j a  va 2  s.c o m*/
    }
    for (int x = 0; x < lv.getCount(); x++) {
        lv.setItemChecked(x, check);
    }
}

From source file:org.odk.collect.android.activities.AppListActivity.java

public static void setAllToCheckedState(ListView lv, boolean check) {
    // no-op if ListView null
    if (lv == null) {
        return;//from  w w  w .j  av  a 2 s.  com
    }

    for (int x = 0; x < lv.getCount(); x++) {
        lv.setItemChecked(x, check);
    }
}

From source file:org.sufficientlysecure.keychain.compatibility.ListFragmentWorkaround.java

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    l.setItemChecked(position, l.isItemChecked(position));
}

From source file:com.commonsware.android.feedfrags.PersistentListFragment.java

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    l.setItemChecked(position, true);
}

From source file:com.edmondapps.android.sample.activity.MainTabletActivity.java

@Override
public void onPresidentSelected(PresidentsFragment f, IPresident p, ListView v, int position) {
    if (Utils.hasHoneyComb()) {
        v.setItemChecked(position, true);
    }//from ww  w  . j  a  va 2  s .  c o m
    ((PresidentFragment) getDetailFragment()).setPresident(p);
}

From source file:com.actionbarsherlock.sample.hcgallery.TitlesFragment.java

public void selectPosition(int position) {
    ListView lv = getListView();
    lv.setItemChecked(position, true);
    updateImage(position);
}

From source file:com.commonsware.android.eu4you.CountriesFragment.java

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    l.setItemChecked(position, true);

    if (listener != null) {
        listener.onCountrySelected(EU.get(position));
    }/*from  w w  w .j  a  v  a  2s  . c  om*/
}

From source file:com.muzima.view.MuzimaListFragment.java

public void unselectAllItems(ListView listView) {
    if (listView == null) {
        return;//from   w  ww  . jav  a2 s  .c o  m
    }
    for (int i = listView.getCount() - 1; i >= 0; i--) {
        listView.setItemChecked(i, false);
    }
}

From source file:dev.ronlemire.dialogs.ListViewFragment.java

public void refresh(int index) {
    mCurCheckPosition = index;/*from  ww  w.  j a  va  2s. c  o  m*/

    // Populate list with our static array of titles.
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(parentActivity, R.array.list_titles,
            android.R.layout.simple_list_item_single_choice);
    setListAdapter(adapter);

    ListView lv = getListView();
    lv.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
    lv.setItemChecked(mCurCheckPosition, true);
    lv.performItemClick(lv, mCurCheckPosition, lv.getItemIdAtPosition(mCurCheckPosition));
}