Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- `FATAL EXCEPTION: main
- Process: dp.develop.ru.startandroid.dp_6, PID: 8603
- java.lang.IllegalStateException: Could not execute method for android:onClick
- at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(App CompatViewInflater.java:293)
- //много всякого
- Caused by: java.lang.reflect.InvocationTargetException
- //много всякого
- Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.CalendarView.setShowWeekNumber(boolean)' on a null object reference`
- //много всякого
- public class MainActivity extends AppCompatActivity {
- TextView DenNedeli; final int DIALOG = 1; LinearLayout linview;
- CalendarView calendarView;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- DenNedeli = (TextView) findViewById(R.id.DenNedeli);
- long date = System.currentTimeMillis();
- SimpleDateFormat sdf = new SimpleDateFormat("EEEE");
- String dateString = sdf.format(date);
- DenNedeli.setText(dateString);
- }
- public void onclick(View view) {
- showDialog(DIALOG);
- }
- @Override
- protected Dialog onCreateDialog(int id) {
- AlertDialog.Builder adb = new AlertDialog.Builder(MainActivity.this);
- adb.setTitle("Выбор даты");
- linview = (LinearLayout) getLayoutInflater()
- .inflate(R.layout.calendarik, null);
- return adb.create();
- }
- @Override
- protected void onPrepareDialog(int id, Dialog dialog) {
- super.onPrepareDialog(id, dialog);
- if (id == DIALOG) {
- calendarView = (CalendarView) dialog.getWindow().findViewById(R.id.calendarView);
- calendarView.setShowWeekNumber(false);
- calendarView.setFirstDayOfWeek(1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement