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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:30:52+00:00 2026-06-08T19:30:52+00:00

I have an expandable list in my application. In group view each element has

  • 0

I have an expandable list in my application. In group view each element has an image in its left side. for this i took an xml for group row with an image view and textview inside a relative layout.
In my custom adapter class, am adding those text and images. text coming from database. and for image am giving drawable name. Following is my adapter class.

public View getGroupView(int groupPosition, boolean isExpanded,
        View convertView, ViewGroup parent) {

    if(convertView==null){
        LayoutInflater vi = LayoutInflater.from(context);
        convertView = vi.inflate(R.layout.event_row, null);
    }
    GroupEvent event = eventlist[groupPosition]; 
    setEventTitle(convertView,event.getEvent());
    setEventIcon(convertView,event.getEvent_icon(), event.getEvent());
    setDivider(convertView,groupPosition);
    return convertView;
}



private void setEventTitle(View convertView, String title) {
    // TODO Auto-generated method stub
    TextView event_title_field = (TextView) convertView.findViewById(R.id.event_name_field);
    event_title_field.setText(title);

}

private void setEventIcon(View convertView, int event_icon, String title) {
    // TODO Auto-generated method stub
    ImageView event_logo = (ImageView) convertView.findViewById(R.id.event_row_image);
    title = String.format( "%s%s",Character.toLowerCase(title.charAt(0)),title.substring(1));
    Log.d("Log","drawable image name "+ title);
    event_logo.setImageResource(context.getResources().getIdentifier(title, "drawable", "com.eteam.ito.history"));

}

It is working fine. But it is not dynamic one and for all rows same image will adding. The drawable image name and the list element text are same. How to give drawable address by using its title?

  • 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-08T19:30:54+00:00Added an answer on June 8, 2026 at 7:30 pm

    See you can add dynamically like this

    event_logo.setImageResource(getResources().getIdentifier(title, "drawable", "com.package.application"))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Expandable List view. In my app both the group and child have
I have an expandable list view where the first group is empty i.e. it
I want to add an image icon in expandable list view .I have seen
I m working on android. i have made expandable list view and its working
Overview: I have an Expandable List View which displays items of the type ToDoElement
I'm working with an Expandable List, like this: The Expandable list activity has a
I've created an activity, which has an expandable list view of category, and some
I have this code for an expandable list, I want to have a checkbox
I have seen in some places that while using Expandable List View we register
I have an expandable list view I am using in one xml file which

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.