I'm trying to draw a Canvas in a View and show this View under some TextViews I defined in my XML file. Everytime I test the App it just doesn't start on the device.
However, the parts themself work:
When I change the setContentView(R.layout.activity_main); in the onCreate() to setContetView(new CustomView(this)); it works, but of course without the textView.
My activity_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mainLayout"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >
    <TextView
        android:id="@+id/sampleText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Some Text"/>
    <com.example.simon.drawtest.CustomView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/sampleText"
        android:layout_alignParentBottom="true"/>
</RelativeLayout>
My MainActivity.java:
package com.example.simon.drawtest;
import android.app.Activity;
import android.os.Bundle;
public class MainActivity extends Activity {
 @Override
 protected void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     setContentView(R.layout.activity_main);
 }
}
My CustomView.java:
package com.example.simon.drawtest;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.view.View;
public class CustomView extends View {
    private Paint paint;
    public CustomView(Context context) {
        super(context);   
        paint = new Paint();
        paint.setColor(Color.GRAY);
    }
    @Override
    protected void onDraw(Canvas canvas) {
        canvas.drawColor(Color.BLUE);
        canvas.drawCircle(200, 200, 100, paint);
    }
}
 
     
    