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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:40:06+00:00 2026-05-30T07:40:06+00:00

I had asked one question about this error before ( Android StackOverflowError in ViewGroup.resetResolvedTextDirection

  • 0

I had asked one question about this error before (Android StackOverflowError in ViewGroup.resetResolvedTextDirection), however now I managed to reproduce the error in the emulator and narrowed down the specific place where this problem occurs.

When I’m starting my activity, I have an AsyncTask, which pulls the necessary data from my server and creates all views. Inside the run() method of the AsyncTask, I’m creating a custom view (and adding it to the main view of the activity – but that’s not important now):

ListingView listing = new ListingView(MainActivity.this);

ListingView is my custom view class, which extends from LinearLayout. In the constructor of this custom view, I have this code:

public ListingView(Context context)
{
    this.context = context;
    ...

    LayoutInflater infl = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View top = infl.inflate(R.layout.listing, this, true);
    this.addView(top);
    ...

    LinearLayout lst = (LinearLayout)this.findViewById(R.id.LayoutListingTop);
    tblVenues = new ListView(context);
    tblVenues.setVisibility(VISIBLE);
    tblVenues.setItemsCanFocus(true);
    tblVenues.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if(venueListener != null && venues.size() > 0) { venueListener.selected(venues.get(position)); }
        }
    });
    LayoutParams lp = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
    lst.addView(tblVenues, lp);    //this line causes the problem

    ...
}

In this custom view class, tblVenues is declared as

private ListView tblVenues;

And the XML that’s being loaded is this:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:id="@+id/LayoutListingTop"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:background="@color/white">
    <ImageView android:id="@+id/ImageView01"
               android:layout_width="170dp"
               android:layout_height="62dp"
               android:src="@drawable/ookl_logo"
               android:layout_gravity="left"
               android:adjustViewBounds="false"
               android:scaleType="fitXY">
    </ImageView>

    <TextView android:layout_height="wrap_content"
              android:layout_width="fill_parent"
              android:layout_marginBottom="5px"
              android:gravity="center"
              android:textColor="@color/black"
              android:text="@string/love_culture"
              android:id="@+id/TextView01"
              android:textSize="28dip">
    </TextView>

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                  android:orientation="horizontal"
                  android:id="@+id/ButtonBar"
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
                  android:background="@drawable/buttonbar"
                  android:paddingLeft="10px"
                  android:paddingRight="10px"
                  android:paddingTop="5px"
                  android:paddingBottom="5px">

        <Button android:id="@+id/BtnListVenues"
                     android:layout_width="wrap_content"
                     android:layout_height="45dip"
                     android:background="@null"
                     android:text="@string/button_venues"
                     android:drawableTop="@drawable/icon_venues_on"
                     android:textColor="@color/venue_blue"
                     android:layout_marginRight="10px"
                     android:textSize="9dip">
        </Button>

        <Button android:id="@+id/BtnListEvents"
                     android:layout_width="wrap_content"
                     android:layout_height="45dip"
                     android:background="@null"
                     android:text="@string/button_events"
                     android:drawableTop="@drawable/icon_events_off"
                     android:textColor="@color/white"
                     android:layout_marginRight="10px"
                     android:textSize="9dip">
        </Button>

        <Button android:id="@+id/BtnListTrails"
                     android:layout_width="wrap_content"
                     android:layout_height="45dip"
                     android:background="@null"
                     android:text="@string/button_trails"
                     android:drawableTop="@drawable/icon_trails_off"
                     android:textColor="@color/white"
                     android:layout_marginRight="10px"
                     android:textSize="9dip">
        </Button>

        <Button android:id="@+id/BtnListObjects"
                     android:layout_width="wrap_content"
                     android:layout_height="45dip"
                     android:background="@null"
                     android:text="@string/button_objects"
                     android:drawableTop="@drawable/icon_objects_off"
                     android:textColor="@color/white"
                     android:layout_marginRight="10px"
                     android:textSize="9dip">
        </Button>

        <TextView android:id="@+id/TxtLabelDistance"
                  android:layout_width="fill_parent"
                  android:text="@string/label_distance"
                  android:layout_height="wrap_content"
                  android:gravity="right|bottom"
                  android:layout_alignParentBottom="true"
                  android:textColor="@color/white"
                  android:layout_marginTop="-17px"
                  android:textSize="9dip">
        </TextView>
    </LinearLayout>


</LinearLayout>

This all works perfectly fine on Android form 1.6 up to 3.x, however on Ice Cream Sandwich (4.0) line

lst.addView(tblVenues, lp);

results in StackOverflowError:

java.lang.StackOverflowError
at android.view.ViewGroup.resetResolvedTextDirection(ViewGroup.java:5131)
at android.view.ViewGroup.resetResolvedTextDirection(ViewGroup.java:5131)
at android.view.ViewGroup.resetResolvedTextDirection(ViewGroup.java:5131)
at android.view.ViewGroup.resetResolvedTextDirection(ViewGroup.java:5131)
at android.view.ViewGroup.resetResolvedTextDirection(ViewGroup.java:5131)
at android.view.ViewGroup.resetResolvedTextDirection(ViewGroup.java:5131)
... this line repeats about 200 times or so ...

There’s nothing else useful in the LogCat. The whole ListingView is not even added to the main activity view yet, because the error is thrown essentially from its constructor.

I’m a total loss as to what may be the problem. Any help will be greatly appreciated.

  • 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-30T07:40:07+00:00Added an answer on May 30, 2026 at 7:40 am

    After banging my head against the wall for quite some time and trying all sorts of different approaches, I believe, this really is a bug in an android, which is exhibited when a View’s visibility is explicitly set to VISIBLE but the view itself and the view’s parent is not added to the main view.

    I finally got around it by adding the ListView to XML and moving the code setVisibility(View.VISIBLE) to after the entire view is added to the main view (i.e. parent hierarchy can be traced from each child all the way to the end).

    At least I’m not getting this error any more.

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

Sidebar

Related Questions

I had asked this question Adding more attributes to LINQ to SQL entity Now,
This question may have been asked before, but I had trouble finding an answer,
I had asked a question about this earlier, but it didn't get answered right
In my previous question on this portal, I had asked about some insight about
I know, variations of this question had been asked before. But my case may
This is a link to a question I had asked two days back, How
I had the same question as was asked in this thread , i.e. I
A co-worker asked about some code like this that originally had templates in it.
i had asked earlier about the same kind of question but that was in
In this question I asked about NHibernate session lifetime. I'm using a desktop application,

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.