title: Access object of one custom view to another Customview, created on Activty class
body: <p>My actual problem: I have an array in <code>CustomView1</code> class. And I want to access it in <code>CustomView2</code> class. And when it will fill, I have to call <code>view2.invalidate()</code>. </p>
  
  <p>This is my activity class:</p>
  
  <pre><code>public class TestApp extends Activity {
  
          CustomView1 view1;
  
          CustomView2 view2;
  
          @Override
          public void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.main);
  
              view1 = (CustomView1) findViewbyId(R.id.CustomViewID1);
              view2 = (CustomView2) findViewbyID(R.id.CustomViewID2);
  
          }
      }
  </code></pre>
  
  <p>This is my first <code>CustomView</code> class . Here I want to call <code>view2.invalidate()</code>.</p>
  
  <pre><code>public class CustomView1 extends View {
  
      byte[] bytearray = new byte[200];
  
      public CustomView1(Context context, AttributeSet attrs) {
          super(context, attrs);
      }
  
      @override
      onDraw() {
          view2.invalidate();
      }
  
  }
  </code></pre>
  
  <p>And this is my second <code>CustomView</code> class. Here I want to access the same object of <code>CustomView1</code>(i.e <code>view1</code> object  ) class that I have created in Activity class. </p>
  
  <pre><code>public class CustomView2 extends View {
  
      public CustomView2(Context context, AttributeSet attrs) {
          super(context, attrs);
      }
  }
  </code></pre>
  
  <p>Is it possible to access like this? Any other idea how to do that? </p>