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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:03:36+00:00 2026-06-03T09:03:36+00:00

I have an Activity which extends ExpandableListActivity and which contains some Parent Groups and

  • 0

I have an Activity which extends ExpandableListActivity and which contains some Parent Groups and some Child Entries…
Left of the entries inside the groups i put an icon. Whenever I open an entry it randomly takes out icons and it’s not showing them anymore… I couldn’t find a pattern there so I’m not quite sure where my mistake is (Maybe I am recycling my objects the wrong way?!)

Here is my BaseExpandableListAdapter:

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

        if (convertView == null) {
            LayoutInflater inflater = (LayoutInflater) myContext
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            convertView = inflater.inflate(R.layout.child_row, null);
        }

        TextView tvName = (TextView) convertView.findViewById(R.id.tvName);
        tvName .setText(arrChildelements[groupPosition][childPosition]);
        ImageView tvIcon = (ImageView) convertView.findViewById(R.id.imageViewIcon);

        switch (childPosition) {
            case 0:
                tvIcon.setImageResource(R.drawable.ic_1);
                break;
            case 1:
                tvIcon.setAlpha(0);
                break;
            case 2:
                tvIcon.setImageResource(R.drawable.ic_2);
                break;
            case 3:
                tvIcon.setImageResource(R.drawable.ic_3);
                break;
            case 4:
                tvIcon.setImageResource(R.drawable.ic_4);
                break;
            case 5:
                tvIcon.setImageResource(R.drawable.ic_5);
                break;
            case 6:
                tvIcon.setImageResource(R.drawable.ic_6);
                break;
        }

        return convertView;
    }

And here is my child_row.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="40dp"
    android:gravity="center_vertical"
    android:orientation="horizontal" >

    <ImageView
        android:id="@+id/imageViewIcon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center_vertical"
        android:paddingLeft="40dp"
        android:src="@drawable/empty" />

    <TextView
        android:id="@+id/tvName"
        android:layout_width="wrap_content"
        android:layout_height="30dp"
        android:autoLink="all"
        android:gravity="center_vertical"
        android:paddingLeft="10dp"
        android:textSize="18sp" >
    </TextView>

</LinearLayout>

If you need any additional information and/or code, please let me know!

Thanks in advance for your help and please excuse my english…

  • 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-03T09:03:37+00:00Added an answer on June 3, 2026 at 9:03 am

    it because tvIcon.setAlpha(0); and ListView optimalization …
    you should set alpha to 1 in other cases (tvIcon.setAlpha(1); before switch statment)…

    Edit:

    or instead tvIcon.setAlpha(0); try tvIcon.setImageResource(R.drawable.empty);

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

Sidebar

Related Questions

I have an activity which shows some List entries. When I click on a
I have an Activity which extends MapActivity (to show a MapView) and contains a
I have created two classes: Example1 and Example2 , which extends activity. Example1 contains
I have an activity with a custom view which extends EditText in it. Usually
I have class A which extends the Activity class. This class is in package
I have a main class which extends Activity which should spawn a ListActivity and
I have created an abstract class which extends the Activity Class. I want to
I have an android activity in which I'm using tabs. public class UnitActivity extends
I am using fragments to show images/pages.I have one Activity(Main) which contains all the
I have an Activity which I start like this: public class MyProblemsActivity extends ListActivity

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.