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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:36:23+00:00 2026-06-18T03:36:23+00:00

i have a problem. Help me please. I have activity with viewpager. See code:

  • 0

i have a problem. Help me please. I have activity with viewpager. See code:

protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    mContext = this;
    setContentView(R.layout.cards);
    expListViewCategory = new ExpandableListView(mContext);
    SetListViewCategory();
    pages = new Vector<View>();
    pages.add(expListViewCategory);
    adapter = new CardsPagerAdapter(mContext, pages);
    pager = (ViewPager)findViewById( R.id.viewpager );
    pager.setAdapter(adapter);
}

private void SetListViewCategory()
    {
        groupData = new ArrayList<Map<String,String>>();
        childData = new ArrayList<ArrayList<Map<String, String>>>();

        String groupFrom[] = new String[] {"groupName"};
        int groupTo[] = new int[] {R.id.textGroup};

        String childFrom[] = new String[] {"imagePath", "subCatName"};
        int childTo[] = new int[] {R.id.cardImage, R.id.textChild};

        SimpleExpandableListAdapter adapter = new SimpleExpandableListAdapter(
                this,
                groupData, R.layout.group_view, groupFrom, groupTo,
                childData, R.layout.child_view, childFrom, childTo);

        expListViewCategory.setAdapter(adapter);

child_view.xml

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:id="@+id/liner">

    <ImageView
          android:id="@+id/cardImage"
          android:layout_width="60dp"
          android:layout_height="40dp"
          android:layout_marginLeft="20dp"
          android:layout_marginTop="20dp"/>

    <TextView
         android:id="@+id/textChild"
         android:layout_width="wrap_content"
         android:layout_height="40dp"
         android:layout_marginLeft="20dp"
         android:layout_marginTop="20dp"
         android:textColor="@android:color/white" />

</LinearLayout>

Not work:

String childFrom[] = new String[] {"imagePath", "subCatName"};
            int childTo[] = new int[] {R.id.cardImage, R.id.textChild};

Work:

String childFrom[] = new String[] {"subCatName"};
        int childTo[] = new int[] {R.id.textChild};

With ImageView i have error: “imageView cannot be cast to android.widget.textview”.

Sorry for my english ! Thanks a lot in advance!

  • 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-18T03:36:24+00:00Added an answer on June 18, 2026 at 3:36 am

    You need to extend your SimpleExpandableListAdapter as they expect TexViews
    http://developer.android.com/reference/android/widget/SimpleExpandableListAdapter.html

    have a look at similar solution
    https://groups.google.com/forum/?fromgroups=#!topic/android-developers/J4H9332aQp4

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

Sidebar

Related Questions

I have problem to add jQuery to some existing code, please help. We have
i am new in php i have a problem in my php code.please help
now,I have a problem,please help me if you know,thanks! I have a Activity to
I think I have a synchronization problem...It may be too basic..Please help.. I have
Please help me solve this problem with capybara I have a button like this
Please help me with following problem. In my android assets folder I have xml
I have a long string, ex: Please help me to solve this problem. This
I have a problem with understanding the following events, please help. I have an
Guys, please help me with the following problem. I have encountered the famous cannot
can anyone help, i have problem doing a sort, I thought i had it

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.