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

  • Home
  • SEARCH
  • 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 6239949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:28:47+00:00 2026-05-24T11:28:47+00:00

My app has a view that gets added to activity programmatically using this code:

  • 0

My app has a view that gets added to activity programmatically using this code:

    RelativeLayout.LayoutParams layoutParams = 
        new RelativeLayout.LayoutParams(480, 75);

    RelativeLayout parent = (RelativeLayout)mMyView.getParent();
    if (parent != null) {
        parent.removeView(mMyView);
    }

    activity.addContentView(mMyView, layoutParams);`

After pressing the Back Button, which ofcourse calls OnDestroy(), and running the app again, I don’t see the View get drawn on the screen, and I get this warning on DDMS when it tries to draw it:

WARN/webcore(5336): Can’t get the viewWidth after the first layout

It’s worth mentioning that the view is functional on this state (the page resources are being loaded, according to the log on DDMS)

Other “regular” views (ImageView, TextView) that are also in the same ContentView are drawing fine.

Any ideas how can I solve this problem, or what can be its source?

  • 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-24T11:28:48+00:00Added an answer on May 24, 2026 at 11:28 am

    Try using parent.forceLayout() then call parent.measure().

    This forces the layout to redraw itself without any regard for other layout requests (and doesn’t redraw the parent views), and then remeasures it with current specs.

    Hope this helps!

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

Sidebar

Related Questions

I have an app that has a centre view with two views off to
I have an iPhone app that shows a simple view (View 1) that has
I have a very simple Mac Cocoa app that just has a Web View
Our iOS app has a Web View that is rendering pages from file: URLs.
My app's main view has a uiwebview. It is white for a split second
I have an view in my App which has a number of buttons based
I have an Eclipse RCP app I'm working on. It has some view-specific menus
My app has many controls on its surface, and more are added dynamically at
Whenever my app is rotated, only the viewController of which I've added his view
My app has 4 tabs. All the view controllers support rotation, and indeed are

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.