I am currently creating a new project that involves a checkbox for a list of items contained in an array.xml. I am using shared preferences and want to be able to pull up the checked items in another activity. I have a button that saves the selections and opens a new activity. Now I am just having trouble having it appear in second activity. I will show my code for my main activity as I am not sure how to begin on the second activity.
@Override
public void onClick(View v) {
    String selected = "";
    int cntChoice = myList.getCount();
    SparseBooleanArray sparseBooleanArray = myList.getCheckedItemPositions();
    for(int i = 0; i < cntChoice; i++){
        if(sparseBooleanArray.get(i)) {
            selected += myList.getItemAtPosition(i).toString() + "\n";
            System.out.println("Checking list while adding:" + myList.getItemAtPosition(i).toString());
            SaveSelections();
            Intent learnintent = new 
            Intent(MainActivity.this,UserList.class);
            learnintent.putExtra("",selected);
            Toast.makeText(MainActivity.this, selected, 
            Toast.LENGTH_LONG).show();
            startActivity(learnintent);
        }
    }
    Toast.makeText(MainActivity.this, selected, 
    Toast.LENGTH_LONG).show();
    }});
    clearAll.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
    // TODO Auto-generated method stub
        ClearSelections();
    }
});
}
private void SaveSelections() {
    // save the selections in the shared preference in private mode for the user
    SharedPreferences.Editor prefEditor = sharedpreferences.edit();
    String savedItems = getSavedItems();
    prefEditor.putString(MyPREFERENCES.toString(), savedItems);
    prefEditor.commit();
}
private String getSavedItems() {
    String savedItems = "";
    int count = this.myList.getAdapter().getCount();
    for (int i = 0; i < count; i++) {
        if (this.myList.isItemChecked(i)) {
            if (savedItems.length() > 0) {
                savedItems += "," + this.myList.getItemAtPosition(i);
            } else {
                savedItems += this.myList.getItemAtPosition(i);
            }
        }
    }
    return savedItems;
}
private void LoadSelections() {
// if the selections were previously saved load them
    if (sharedpreferences.contains(MyPREFERENCES.toString())) {
        String savedItems = sharedpreferences.getString(MyPREFERENCES.toString(), "");
        selectedItems.addAll(Arrays.asList(savedItems.split(",")));
        int count = this.myList.getAdapter().getCount();
        for (int i = 0; i < count; i++) {
            String currentItem = (String) myList.getAdapter().getItem(i);
            if (selectedItems.contains(currentItem)) {
                myList.setItemChecked(i, true);
                Toast.makeText(getApplicationContext(), "Curren Item: " + currentItem,Toast.LENGTH_LONG).show();
            } else {
                myList.setItemChecked(i, false);
            }
        }
    }
}
private void ClearSelections() {
    // user has clicked clear button so uncheck all the items
    int count = this.myList.getAdapter().getCount();
    for (int i = 0; i < count; i++) {
        this.myList.setItemChecked(i, false);
    }
    // also clear the saved selections
    SaveSelections();
}
 
     
     
    