• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Dynamic Views after Layout

glitch83

Lurker
Apr 9, 2010
1
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:
protected void  onLayout  (boolean changed, int left, int top, int right, int bottom) {
    this.removeAllViews();
          for(View v : views) {
              System.out.println("Added view");
              addView(v);
          }
          System.out.println("Relaid out");
      } catch(Exception e) {
          e.printStackTrace();
      }
}
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
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones