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 7013195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:21:18+00:00 2026-05-27T22:21:18+00:00

I am a new bee to android. I am working with ExpandableListViewAdapter and facing

  • 0

I am a new bee to android.

I am working with ExpandableListViewAdapter and facing a problem.

The onChildClickListener is not working when I click on the edit text box.

My question is will it work on edit text box or not.

I am implementing the BaseExpandableListAdapter.

Thanks in advance.

public class TryExpandableListViewActivity extends Activity implements     OnChildClickListener {

LinearLayout llayout;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    llayout = (LinearLayout) findViewById(R.id.llayout);

    ExpandableListView list = new ExpandableListView(this);
    list.setGroupIndicator(null);
    list.setChildIndicator(null);
    String[] titles = {"A","B","C"};
    String[] fruits = {"a1","a2"};
    String[] veggies = {"b1","b2","b3"};
    String[] meats = {"c1","c2"};
    String[][] contents = {fruits,veggies,meats};
    SimplerExpandableListAdapter adapter = new SimplerExpandableListAdapter(this,titles, contents);

    list.setAdapter(adapter);

    llayout.addView(list);

    list.setOnChildClickListener(this);
}

@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
    Log.i("Test","-------------------------------------------");
    return false;
}

}

class SimplerExpandableListAdapter extends BaseExpandableListAdapter {

private Context mContext;
private String[][] mContents;
private String[] mTitles;

public SimplerExpandableListAdapter(Context context, String[] titles, String[][] contents) {
    super();
    if(titles.length != contents.length) {
      throw new IllegalArgumentException("Titles and Contents must be the same size.");
    }
    mContext = context;
    mContents = contents;
    mTitles = titles;

  }

@Override
public Object getChild(int groupPosition, int childPosition) {
    return mContents[groupPosition][childPosition];
}

@Override
public long getChildId(int groupPosition, int childPosition) {
    return 0;
}

@Override
public View getChildView(int groupPosition, int childPosition,
    boolean isLastChild, View convertView, ViewGroup parent) { 

        EditText row = (EditText)convertView;
        if(row == null) {
          row = new EditText(mContext);
        }
        row.setTypeface(Typeface.DEFAULT_BOLD);
        row.setText(mContents[groupPosition][childPosition]);
        return row;

}

@Override
public int getChildrenCount(int groupPosition) {
    return mContents[groupPosition].length;
}

@Override
public Object getGroup(int groupPosition) {
    return mContents[groupPosition];
}

@Override
public int getGroupCount() {
    return mContents.length;
}

@Override
public long getGroupId(int groupPosition) {
    return 0;
}

@Override
public View getGroupView(int groupPosition, boolean isExpanded,
    View convertView, ViewGroup parent) {
    TextView row = (TextView)convertView;
    if(row == null) {
      row = new TextView(mContext);
    }
    row.setTypeface(Typeface.DEFAULT_BOLD);
    row.setText(mTitles[groupPosition]);
    return row;
}

@Override
public boolean hasStableIds() {
    return false;
}

@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
    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-05-27T22:21:19+00:00Added an answer on May 27, 2026 at 10:21 pm

    Without seeing code this is just a guess but the childCLickListener may be consuming the event so its not reaching the edit text, try returning false in childClickListener

    Edit

    Okay I just created a small project with your code and I couldn’t get the onCildClickListener to fire, changing it to a TextView and it works fine. Its something to do with the EditText (perhaps its consuming the event or its not registering as a click but as a change in focus but I’m just guessing at this point).

    So in answer to your question, is it possible – I don’t think so. But I did make a small workaround that may be of use.

    Attach an onTouchListener() to the EditText and check for MotionEvent.ACTION_DOWN

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

Sidebar

Related Questions

I am new bee in Android , so the knowledge regarding android is not
I am new bee in ANDROID so am getting problem in retrieving data especially
I am new bee in ANDROID , so for that I am unable to
I am new bee in Android, so for that I have only limited knowledge
Hello Everyone I'm really new bee in android and for that I'm confused to
I am new bee to android and stack overflow too. I am developing an
Hi i'm new bee to android. while executing my application I'm getting nullpoint exception
I've bee reading up on git and git-svn. I'm pretty new to git but
I'm guessing this will be such a newbee question but I hit a wall
Still new to the memory management in iPhone apps, I have a newbee question.

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.