title: Timepicker from android developers not static allowed
body: <p>I took the original TimePicker-Source from <a href="http://developer.android.com/guide/topics/ui/controls/pickers.html" rel="nofollow">Android Developers</a></p>
  
  <p>and paste it in a new class in Android Studio. Android Studio throws an error "Modifier 'static' not allowed here". What's wrong? Here's the source:</p>
  
  <pre><code>public static class TimePickerFragment extends DialogFragment
                          implements TimePickerDialog.OnTimeSetListener {
  
      @Override
      public Dialog onCreateDialog(Bundle savedInstanceState) {
          // Use the current time as the default values for the picker
          final Calendar c = Calendar.getInstance();
          int hour = c.get(Calendar.HOUR_OF_DAY);
          int minute = c.get(Calendar.MINUTE);
  
          // Create a new instance of TimePickerDialog and return it
          return new TimePickerDialog(getActivity(), this, hour, minute,
                  DateFormat.is24HourFormat(getActivity()));
      }
  
      public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
          // Do something with the time chosen by the user
      }
  }
  </code></pre>
  
  <p>And btw: is there an easy way to use a timepicker in an activity? Nearly all examples here work with "showDialog()", which is depricated.</p>