Switch (Button) throws NullPointerException
问题 I know this question already exists, but I tried serveral solutions and none worked for me. In my case, I need a Switch Button in the ActionBar. I tried to manually add a minSdk Verision I tried to use the id of the item in the defined xml Edit: The exception-point in the code is marked with a comments. It's in the mainactivity. :) Here is some of my code: mainactivity: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout