Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9034201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T08:25:13+00:00 2026-06-16T08:25:13+00:00

I have writing a mediaplayer app. When clicked on the play list button, ExpandList

  • 0

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

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<String> groupItem = new ArrayList<String>();
ArrayList<Object> childItem = new ArrayList<Object>();

public void setChildGroupData() {
    /**
     * Add Data For TecthNology
     */
    ArrayList<String> child = new ArrayList<String>();
    child.add("Java");
    child.add("Drupal");
    child.add(".Net Framework");
    child.add("PHP");
    childItem.add(child);

    /**
     * Add Data For Mobile
     */
    child = new ArrayList<String>();
    child.add("Android");
    child.add("Window Mobile");
    child.add("iPHone");
    child.add("Blackberry");
    childItem.add(child);
    /**
     * Add Data For Manufacture
     */
    child = new ArrayList<String>();
    child.add("HTC");
    child.add("Apple");
    child.add("Samsung");
    child.add("Nokia");
    childItem.add(child);
    /**
     * Add Data For Extras
     */
    child = new ArrayList<String>();
    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;
}
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T08:25:14+00:00Added an answer on June 16, 2026 at 8:25 am

    If you are calling this activity using startActivityForResult(), then correct way to return to calling activity is as follows:

    Intent returnIntent = new Intent();
    returnIntent.putExtra("childPosition", childPosition);
    setResult(RESULT_OK,returnIntent);        
    finish();
    

    So you need to remove these lines:

    Intent in = new Intent(getApplicationContext(),
                AndroidBuildingMusicPlayerActivity.class);
    startActivity(in);
    

    Hope it helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been writing some code which pulls entries from a MySQL database. These
I have been writing applications which are layered as: DB<->DAL<->BL<->Service<->Presentation And that's all that
I have been writing some C# code for a training exercise, in which I
I have been writing an OpenGL game engine for a while which uses SDL
I have writing a method which needs to be able to take an arbitrary
I have writing a small shooting game in cocos2d. Winning the game is to
I have been writing linear winforms for couple of months and now I am
I have been writing a SOAP client application in C++ on Ubuntu using OpenSSL
I have been writing C++ Console/CMD-line applications for about a year now and would
I have been writing unit tests using NUnit and Moq with my Silverlight code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.