title: Date Picker Android Show Random Date
body: <p>Setting up Date picker using <strong>Datapicker.update(year,month,day);</strong> gives me random date even if the date is correct so any help please I use the same Activity for Add or Edit a Task </p>
  
  <p>here is my Code </p>
  
  <pre><code> protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_add);
      databaseConnector = new DatabaseConnector(this);
      title = (EditText) findViewById(R.id.TitleET);
      subject = (EditText) findViewById(R.id.SubjectET);
      category = (Spinner) findViewById(R.id.CategorySpinner);
      datePicker = (DatePicker) findViewById(R.id.datePicker);
      ArrayAdapter&lt;CharSequence&gt; adapter = ArrayAdapter.createFromResource(this, R.array.Category, android.R.layout.simple_spinner_item);
      category.setAdapter(adapter);
       extra = getIntent().getExtras();
      if(extra !=null)
      {
          String [] spli = extra.getString("Date").split("-");
          row_id = extra.getLong("row_id");
          title.setText(extra.getString("Title"));
          subject.setText(extra.getString("Subject"));
          if(extra.getString("Category").equals("Exam"))
          {
              category.setSelection(0);
          }
          else
          {
              category.setSelection(1);
          }
          datePicker.updateDate(Integer.parseInt(spli[2]),Integer.parseInt(spli[1]),Integer.parseInt(spli[0]));
      }
  }
  </code></pre>