Dealing with Listeners
<p>I know the listeners are supposed to make life easier, especially in a multi-tasking environment like android, but sometimes (to me) it just makes things harder.</p>

<p>Right now I have an ExpandableList activity which presents a list of events, and I want the user to select the group &amp; child of interest and select a notification sound that will play when that event happens. So the list is set up and I have a setOnChildClickListener set up which runs my SetRingtone method:</p>

<pre><code>protected void SetRingtone(int groupPosition, int childPosition) {
  Intent intent = new Intent( RingtoneManager.ACTION_RINGTONE_PICKER);
  intent.putExtra( RingtoneManager.EXTRA_RINGTONE_TYPE, 
    RingtoneManager.TYPE_ALL);
  intent.putExtra( RingtoneManager.EXTRA_RINGTONE_TITLE, 
    "Select Tone");
  startActivityForResult( intent, PICK_NOTIFICATION_SOUND); 
}
</code></pre>

<p>So that method has access to the selected group and child positions. The problem is that to get the ringtone selected from the ringtone selector, you have to set up another lister, onActivityResult:</p>

<pre><code>protected void onActivityResult(int requestCode, 
    int resultCode, Intent data) {
  if (resultCode == RESULT_OK) {
    Uri uri = 
     data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI);
    if (uri != null) {
      String ringTonePath = uri.toString();
      ExpandableListView variableView = 
      (ExpandableListView)findViewById(android.R.id.list);
      int p = variableView.getSelectedItemPosition();
      Log.d("phca", "The selected item number was: " + 
      p + "; The sound selected is: " + uri );
    }
  }
}
</code></pre>

<p>And now I don't have access to the selected group and child. As you can see, I tried to get the position from the getSelectedItemPosition, but it always returns -1 here.</p>

<p>I know I am probably making this harder than it really is.</p>
