Note that there are some explanatory texts on larger screens.

plurals
  1. POExpandableListView onChildClick not working
    primarykey
    data
    text
    <p>I have writing a mediaplayer app. When clicked on the play list button, ExpandList Activity launches and depending on which child is clicked, it should start my main activity and return the childposition. But it doenst do anything. There is no error or anything. It seems like its not even going into the onChildClick method and I am not sure why. I have looked at many examples and they all seem to have it the same why I have it. I was hoping someone could point out what I am doing wrong. Here is my code below. Thank you</p> <pre><code>import java.util.ArrayList; import android.app.ExpandableListActivity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.widget.ExpandableListView; import android.widget.ExpandableListView.OnChildClickListener; import android.widget.Toast; public class ExpandListActivity extends ExpandableListActivity implements OnChildClickListener { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ExpandableListView expandbleLis = getExpandableListView(); expandbleLis.setDividerHeight(2); expandbleLis.setGroupIndicator(null); expandbleLis.setClickable(true); expandbleLis.setOnChildClickListener(this); setGroupData(); setChildGroupData(); NewAdapter mNewAdapter = new NewAdapter(groupItem, childItem); mNewAdapter .setInflater( (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE), this); expandbleLis.setAdapter(mNewAdapter); } public void setGroupData() { groupItem.add("TechNology"); groupItem.add("Mobile"); groupItem.add("Manufacturer"); groupItem.add("Extras"); } ArrayList&lt;String&gt; groupItem = new ArrayList&lt;String&gt;(); ArrayList&lt;Object&gt; childItem = new ArrayList&lt;Object&gt;(); public void setChildGroupData() { /** * Add Data For TecthNology */ ArrayList&lt;String&gt; child = new ArrayList&lt;String&gt;(); child.add("Java"); child.add("Drupal"); child.add(".Net Framework"); child.add("PHP"); childItem.add(child); /** * Add Data For Mobile */ child = new ArrayList&lt;String&gt;(); child.add("Android"); child.add("Window Mobile"); child.add("iPHone"); child.add("Blackberry"); childItem.add(child); /** * Add Data For Manufacture */ child = new ArrayList&lt;String&gt;(); child.add("HTC"); child.add("Apple"); child.add("Samsung"); child.add("Nokia"); childItem.add(child); /** * Add Data For Extras */ child = new ArrayList&lt;String&gt;(); child.add("Contact Us"); child.add("About Us"); child.add("Location"); child.add("Root Cause"); childItem.add(child); } @Override public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { Toast.makeText(ExpandListActivity.this, "Clicked On Child", Toast.LENGTH_SHORT).show(); // Starting new intent Intent in = new Intent(getApplicationContext(), AndroidBuildingMusicPlayerActivity.class); // Sending childPosition to PlayerActivity in.putExtra("childPosition", childPosition); Log.println(0, getClass().getName(), "onChildClick inside"); setResult(100, in); startActivity(in); // Closing PlayListView finish(); return true; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload