Advertisement
Guest User

Untitled

a guest
May 5th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. `FATAL EXCEPTION: main
  2. Process: dp.develop.ru.startandroid.dp_6, PID: 8603
  3. java.lang.IllegalStateException: Could not execute method for android:onClick
  4. at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(App CompatViewInflater.java:293)
  5. //много всякого
  6. Caused by: java.lang.reflect.InvocationTargetException
  7. //много всякого
  8. Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.CalendarView.setShowWeekNumber(boolean)' on a null object reference`
  9. //много всякого
  10.  
  11. public class MainActivity extends AppCompatActivity {
  12. TextView DenNedeli; final int DIALOG = 1; LinearLayout linview;
  13. CalendarView calendarView;
  14.  
  15. @Override
  16. protected void onCreate(Bundle savedInstanceState) {
  17. super.onCreate(savedInstanceState);
  18. setContentView(R.layout.main);
  19. DenNedeli = (TextView) findViewById(R.id.DenNedeli);
  20. long date = System.currentTimeMillis();
  21. SimpleDateFormat sdf = new SimpleDateFormat("EEEE");
  22. String dateString = sdf.format(date);
  23. DenNedeli.setText(dateString);
  24. }
  25.  
  26. public void onclick(View view) {
  27. showDialog(DIALOG);
  28. }
  29.  
  30. @Override
  31. protected Dialog onCreateDialog(int id) {
  32. AlertDialog.Builder adb = new AlertDialog.Builder(MainActivity.this);
  33. adb.setTitle("Выбор даты");
  34. linview = (LinearLayout) getLayoutInflater()
  35. .inflate(R.layout.calendarik, null);
  36. return adb.create();
  37. }
  38.  
  39. @Override
  40. protected void onPrepareDialog(int id, Dialog dialog) {
  41. super.onPrepareDialog(id, dialog);
  42. if (id == DIALOG) {
  43. calendarView = (CalendarView) dialog.getWindow().findViewById(R.id.calendarView);
  44. calendarView.setShowWeekNumber(false);
  45. calendarView.setFirstDayOfWeek(1);
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement