Java: Get key set values
<p>I need to know how to carry the values of a certain key set into another activity form. I have a list that contains a key and all the values with in that key. I want it so that when the user clicks an item in the list, another activity will load with the values of that specific item clicked. </p>

<p>For example, if I have a key set called Running as an item in a list, and the values of that set are the StartTime and EndTime of the run, how can I display just these values belonging to that set over into the next activity. This is hard to explain but I hope my code with make it clear what I am asking for.</p>

<pre><code>public class ActivityLog extends Activity {
ListView listView ;



@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_log);

    // Get ListView object from xml
    listView = (ListView) findViewById(R.id.list);
    listView.setFriction(ViewConfiguration.getScrollFriction() * 0);
    // ListView Item Click Listener
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {


        @Override
        public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {

            int itemPosition     = position;
            String  itemValue    = (String) listView.getItemAtPosition(position);


            // ListView Clicked item index


            // ListView Clicked item value

            // Show Alert
           Toast.makeText(getApplicationContext(), "Position :"+itemPosition+"  ListItem : " +itemValue , Toast.LENGTH_LONG).show();

        }

    });
}

@Override
protected void onStart()
{
    SharedPreferences userInfo = getSharedPreferences("userData", Context.MODE_PRIVATE);
    SharedPreferences.Editor editor = userInfo.edit();
    String myString = userInfo.getAll().keySet().toString();
    String[] values = new String[] { myString };

    ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.activity_list_item, android.R.id.text1 );


    Map&lt;String, ?&gt; allEntries = userInfo.getAll();
    for (Map.Entry&lt;String, ?&gt; entry : allEntries.entrySet()) {

        Log.d("map values", entry.getKey() + ": " + entry.getValue().toString());
        adapter.add(entry.getKey()+ ": " + entry.getValue().toString());
        listView.setAdapter(adapter);

    }
    super.onStart();
}


public void showLog (View view){

    Intent intent = new Intent(this, ActivityNewLog.class);
    startActivity(intent);

}


public void deleteLog (View view){

    SharedPreferences settings = getSharedPreferences("userData", Context.MODE_PRIVATE);
    settings.edit().clear().commit();
    getSharedPreferences("userData", 0).edit().clear().commit();

}

public void dataShow (View view){

   Intent intent = new Intent(this, Log_Data.class);
    startActivity(intent);

}
</code></pre>

<p>}</p>

<p>this is the activity where i want to load the values:</p>

<pre><code>public class Log_Data extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_log__data);
    TextView data = (TextView)findViewById(R.id.textView5);

    SharedPreferences userInfo = getSharedPreferences("userData", Context.MODE_PRIVATE);
    SharedPreferences.Editor editor = userInfo.edit();
    String myString = userInfo.getAll().keySet().toString();
    String[] values = new String[] { myString };

    //ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.activity_list_item, android.R.id.text1 );
    Map&lt;String, ?&gt; allEntries = userInfo.getAll();
    for (Map.Entry&lt;String, ?&gt; entry : allEntries.entrySet()) {

        data.setText(entry.getKey()+ ": " + entry.getValue().toString());

    }


    }
}
</code></pre>

<p>I should also mention, I want them to be stored in a textView.</p>