title: Android, painting on my own, "divided" layout doesn't work
body: <p>I need to create a layout, which must be divided in half, like this:</p>
  
  <pre><code>-------
  |     |
  |  A  |
  |     |
  -------
  |     |
  |  B  |
  |     |
  -------
  </code></pre>
  
  <p>Where:<br>
  A - this is the place, where I can draw points with a finger;<br>
  B - it is an example <code>ListView</code>.  </p>
  
  <p>It looks like no object from class <code>SampleView</code> was created, so painting in A doesn't work.<br>
  What's wrong with that?<br>
  How do I need to fix painting?</p>
  
  <p><strong>drawing_activity.xml</strong>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:layout_weight="1"
  android:orientation="vertical" &gt;
  
  
  
      &lt;View
          class="com.example.proj.SampleView"
          android:id="@+id/sampleView1"
          android:layout_width="wrap_content"
          android:layout_height="0dp"
          android:layout_weight=".50" /&gt;
  
  
  
      &lt;ListView
          android:id="@+id/listView1"
          android:layout_width="match_parent"
          android:layout_height="0dp"
          android:layout_weight=".50" &gt;
      &lt;/ListView&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p><strong>SampleView.java</strong>:</p>
  
  <pre><code>package com.example.proj;
  
  import java.util.ArrayList;
  import java.util.List;
  
  import android.content.Context;
  import android.graphics.Canvas;
  import android.graphics.Color;
  import android.graphics.Paint;
  import android.util.AttributeSet;
  import android.util.Log;
  import android.view.MotionEvent;
  import android.view.View;
  import android.view.View.OnTouchListener;
  
  public class SampleView extends View implements OnTouchListener {
      private static final String TAG = "SampleView";
      List&lt;Point&gt; points = new ArrayList&lt;Point&gt;();
      Paint paint = new Paint();
  
      public SampleView(Context context, AttributeSet attrs, int defStyle) {
          super(context, attrs, defStyle);
          setFocusable(true);
          setFocusableInTouchMode(true);
  
          this.setOnTouchListener(this);
  
          paint.setColor(Color.BLACK);
          paint.setAntiAlias(true);
  
          Log.i(TAG, "Created SampleView!");
      }
  
      @Override
      public void onDraw(Canvas canvas) {
          for (Point point : points) {
              canvas.drawCircle(point.x, point.y, 5, paint);
              Log.d(TAG, "Painting: "+point);
          }
      }
  
      public boolean onTouch(View view, MotionEvent event) {
          if(event.getAction() != MotionEvent.ACTION_DOWN)
             return super.onTouchEvent(event);
          Point point = new Point();
          point.x = event.getX();
          point.y = event.getY();
          points.add(point);
          invalidate();
          Log.d(TAG, "point: " + point);
          return true;
      }
  
  }
  
  
  class Point {
      float x, y;
  
      @Override
      public String toString() {
          return x + ", " + y;
      }
  }
  </code></pre>
  
  <p><strong>MainActivity.java</strong>:</p>
  
  <pre><code>package com.example.proj;
  
  import java.util.ArrayList;
  
  import android.os.Bundle;
  import android.app.Activity;
  import android.widget.ListView;
  
  public class MainActivity extends Activity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.drawing_activity);
          final ListView listview = (ListView) findViewById(R.id.listView1);
          String[] values = new String[] { "Element1", "Element2" };
  
          final ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;();
          for (int i = 0; i &lt; values.length; ++i) {
            list.add(values[i]);
          }
          final StableArrayAdapter adapter = new StableArrayAdapter(this,
              android.R.layout.simple_list_item_1, list);
          listview.setAdapter(adapter);
      }
  
  }
  </code></pre>