1. Download our Official Android App: Forums for Android!

Apps Dynamic Views after Layout

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

  1. glitch83

    glitch83 Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    1
    Joined:
    Apr 9, 2010

    Apr 9, 2010
    1
    0
    5
    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 Lurker
    Rank:
    None
    Points:
    5
    Posts:
    2
    Joined:
    Feb 14, 2009

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

Share This Page

Loading...