Code example for ListFragment

0
import android.os.Bundle; 
import android.support.v4.app.ListFragment; 
import android.view.View; 
import android.widget.ListView; 
 
public class PersistentListFragment extends ListFragment {
  static public final String STATE_CHECKED="com.commonsware.android.feedfrags.STATE_CHECKED";
 
  @Override 
  public void onListItemClick(ListView l, View v, int position,
                              long id) {
    l.setItemChecked(position, true);
  } 
   
  @Override 
  public void onSaveInstanceState(Bundle state) {
    state.putInt(STATE_CHECKED,
                  getListView().getCheckedItemPosition());
  } 
   
  protected void restoreState(Bundle state) {