Textview's value not updating while extending LinearLayout
<p>I have my class which is extending <code>LinearLayout</code>.</p>

<p>Code snippet as below :</p>

<pre><code>class MyLinearLayout extends LinearLayout{

static TextView  txt;
static Button btn;
static LayoutInflater inflater;

public MyLinearLayout(Context context) {
    super(context);
    // TODO Auto-generated constructor stub
    View.inflate(context, R.layout.displayinfo, this);
    inflater = (LayoutInflater)  getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);

}

@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
    // TODO Auto-generated method stub
    super.onLayout(changed, l, t, r, b);
}

public  void change(){

     View view =inflater.inflate(R.layout.displayinfo, null);
     //Button btn = (Button) inflate(context, R.id.btn, null);
     txt = (TextView) view.findViewById(R.id.textView1);
     Handler handler = new Handler() {
         @Override
         public void handleMessage(Message msg) {
             txt.setText("Changed");

         }
     };
     //view.refreshDrawableState();


}

@Override
protected void onDraw(Canvas canvas) {
    change();
}
}
</code></pre>

<p>But the value is not getting changed when <code>onDraw()</code>-><code>change()</code> method is getting called.
I am adding this view to <code>WindowManager</code>.</p>

<p>In this extended view I have to basically update values from an <code>array</code>. But the problem is how to call the loop continuously? Calling an <code>invalidate()</code> helps me to call it continuously but it increases the CPU usage as well as the view gets refreshed so fast that user cannot actually view the <code>View</code>.</p>

<p>so basically I have two problems:</p>

<p>1.<code>TextView</code> not getting updated in above code snippet?</p>

<p>2.How do we basically continuously update a views value without calling an <code>invalidate()</code> method ?</p>

<p>Thanks in advance</p>
