Dynamic Views after Layout


Last Updated:

  1. glitch83

    glitch83 New Member This Topic's Starter

    Joined:
    Apr 9, 2010
    Messages:
    1
    Likes Received:
    0
    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):
    1.  
    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. }
    13.  
    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?!

    ~Nick
     

    Advertisement
  2. jordan_old

    jordan_old New Member

    Joined:
    Feb 14, 2009
    Messages:
    2
    Likes Received:
    0
    I'm having pretty much the same problem. So did you ever find a solution?
     

Share This Page

Loading...