Hello felix,
an essential information is where/when the error occurs.
I never tried it myself, but I found two hints in the sdk, that it
maybe is only possible within onCreate():
When Android compiles your application, it compiles each file into an android.view.View resource that you can load in code by calling setContentView(R.layout.layout_file_name) in your Activity.onCreate() implementation.
onCreate(Bundle) is where you initialize your activity. Most importantly, here you will usually call setContentView(int) with a layout resource defining your UI, and using findViewById(int) to retrieve the widgets in that UI that you need to interact with programmatically.
BUT there at least exists a function that indicates that is
maybe posbbile:
onContentChanged()
This hook is called whenever the content view of the screen changes (due to a call to setContentView().)
So let us know on which line the exception is thrown (directly when you start your app or just when clicking the button).
Regards,
plusminus