I've got an activity that uses a thread in order to read a some content from a file.  

The problem is that if the user decides to rotate the screen while the thread is running the application crushes.   

I know that I can prevent the screen from rotating using:

```
android:screenOrientation="portrait"

```

But what I want to do is to stop the thread from running so the application can restart safely or prevent the activity from restarting.