Code example for ListView

Methods: setItemChecked

0
    } 
  } 
 
  @Override 
  public void onListItemClick(ListView l, View v, int position, long id) {
    l.setItemChecked(position, true);
 
    getContract().onPackageSelected(adapter.getItem(position));
  } 
 
  @Override 
  public void onSaveInstanceState(Bundle state) {
    super.onSaveInstanceState(state);
 
    state.putInt(STATE_CHECKED, getListView().getCheckedItemPosition());
  } 
 
  interface Contract { 
    void onPackageSelected(PackageInfo pkgInfo);
 
    List<PackageInfo> getPackageList();