Attempt to invoke virtual method '...TextView.setText(java.lang.CharSequence)' on a null object reference

Simple problem and even simpler fix. You are accessing a view prior to inflating layout. Your code needs to instead by rearranged this way:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView( R.layout.activity);

    TextView t= (TextView)findViewById(R.id.startofweek);
    t.setText("05.09.2016");    
}

In your xml file, you used "example" as the id of your TextView. But, inside the code, you are looking for "R.id.startofweek" when you are initializing your TextView.

PS: You also called "setContentView( R.layout.activities);" after the variable initialization. It has to be done before you initialize the TextView.

You can use the following code:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView( R.layout.activities);

    TextView t= (TextView)findViewById(R.id.example);
    t.setText("05.09.2016");

}