1. Check out our companion app, Forums for Android! Download from Google Play

Dynamic Views after Layout

Discussion in 'Application Development' started by glitch83, Apr 9, 2010.

  1. glitch83

    glitch83 New Member
    Thread Starter

    Apr 9, 2010
    I'm at my wits end, and absolutely frustrated.

    After you get past the first onCreate phase, how can one addView(...) ? I have a single update thread watching a network site and when it changes, the UI should change. It's far too complicated for me to post the actual code but some excerpts are the onLayout method:
    Code (Text):
    2. protected void  onLayout  (boolean changed, int left, int top, int right, int bottom) {
    3.     this.removeAllViews();
    4.           for(View v : views) {
    5.               System.out.println("Added view");
    6.               addView(v);
    7.           }
    8.           System.out.println("Relaid out");
    9.       } catch(Exception e) {
    10.           e.printStackTrace();
    11.       }
    12. }
    for a custom LinearLayout class. After the initial onCreate/onLayout, everything starts off fine, but when I requestLayout, the actual view doesn't change at all with no exceptions. I have no idea where I'm going wrong, i've called all the invalidate(), refreshDrawableState(), requestLayout() calls but nothing is updating the view and I'm showing new views in the onLayout create loop. Anybody have any ideas how to actually redraw and refresh the layout? What am I doing wrong?!



  2. jordan_old

    jordan_old New Member

    Feb 14, 2009
    I'm having pretty much the same problem. So did you ever find a solution?

Share This Page