title: String to Localdate DateTimeParseException
body: <p>I'm loading a string from SQLite database, then trying to convert it to a LocalDate so I can add it as an object parameter, then compare the date of objects on a list.</p>
  
  <p>But the app crashes and gives DateTimeParseException.</p>
  
  <p>This is the method that crashes, and it crashes at the line where I'm creating the LocalDate.</p>
  
  <p>I have found and read many similar threads on this site and others too, but sadly I couldn't figure out what is the problem exactly.</p>
  
  <pre><code>private void fillEventsArray(){
      Cursor data = mDatabaseHelper.getData();
      while(data.moveToNext()){
          String name = data.getString(1);
          String description = data.getString(2);
          String time = data.getString(3);
          String date = data.getString(4);
  
          LocalDate localDate= LocalDate.parse(date, DateTimeFormatter.ofPattern("yyyy/MM/dd"));
  
          LocalTime localTime=LocalTime.parse(time, DateTimeFormatter.ofPattern("HH:mm"));
  
          Event event = new Event(name, description, localTime, localDate);
  
          events.add(event);
      }
  </code></pre>
  
  <p>I'm saving data in column 4 in the same "yyyy/mm/dd" format, like 2018/11/20.</p>
  
  <p>Previously I also tryed turning the strings into LodalDate/LocalTime like this, but it had the same problems:</p>
  
  <pre><code>                String year=date.substring(0,4);
                  String month=date.substring(5,7);
                  String day=date.substring(8,10);
                  LocalDate localDate=LocalDate.of(Integer.parseInt(year),Integer.parseInt(month),Integer.parseInt(day));
                  String hour=time.substring(0,3);
                  String minute=time.substring(4,5);
                  LocalTime localTime=LocalTime.of(Integer.parseInt(hour),Integer.parseInt(minute));
  </code></pre>
  
  <p>Does it cause an error if the database is empty?</p>
  
  <p>If any more information is required let me know and I'll provide it.</p>
  
  <p>Logcat copy:</p>
  
  <pre><code>2018-11-12 15:48:57.836 12038-12038/com.example.dflavio.calendar E/AndroidRuntime: FATAL EXCEPTION: main
  Process: com.example.dflavio.calendar, PID: 12038
  java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.dflavio.calendar/com.example.dflavio.calendar.MainActivity}: java.time.format.DateTimeParseException: Text 'android.support.v7.widget.AppCompatEditText{ceb966d VFED..CL. .F...' could not be parsed at index 0
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
      at android.app.ActivityThread.-wrap11(Unknown Source:0)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
      at android.os.Handler.dispatchMessage(Handler.java:105)
      at android.os.Looper.loop(Looper.java:164)
      at android.app.ActivityThread.main(ActivityThread.java:6541)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
   Caused by: java.time.format.DateTimeParseException: Text 'android.support.v7.widget.AppCompatEditText{ceb966d VFED..CL. .F...' could not be parsed at index 0
      at java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:1948)
      at java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1851)
      at java.time.LocalDate.parse(LocalDate.java:394)
      at com.example.dflavio.calendar.MainActivity.fillEventsArray(MainActivity.java:104)
      at com.example.dflavio.calendar.MainActivity.onCreate(MainActivity.java:45)
      at android.app.Activity.performCreate(Activity.java:6975)
      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892) 
      at android.app.ActivityThread.-wrap11(Unknown Source:0) 
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593) 
      at android.os.Handler.dispatchMessage(Handler.java:105) 
      at android.os.Looper.loop(Looper.java:164) 
      at android.app.ActivityThread.main(ActivityThread.java:6541) 
      at java.lang.reflect.Method.invoke(Native Method) 
      at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) 
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) 
  </code></pre>
  
  <p>As somebody have pointed out I might have made a mistake at how I get the strings from my edittexts. Currently this is how the code looks:</p>
  
  <pre><code>createBtn.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
  
                  EditText nameEditText = (EditText) findViewById(R.id.nameEditText);
                  EditText descriptionEditText = (EditText) findViewById(R.id.descriptionEditText);
                  EditText timeEditText = (EditText) findViewById(R.id.timeEditText);
                  EditText dateEditText = (EditText) findViewById(R.id.dateEditText);
  
              String name = nameEditText.getText().toString();
              String description = descriptionEditText.getText().toString();
              String time = timeEditText.getText().toString();
              String date = dateEditText.getText().toString();
              if (name.length() != 0){
                  if (description.length() != 0){
                      if (time.length() != 0){
                          if (date.length() != 0){
                              AddData(name, description, time, date);
                              nameEditText.setText("");
                              descriptionEditText.setText("");
                              timeEditText.setText("");
                              dateEditText.setText("");
                          }
                      }
                  }
              }else{
                  toastMessage("Fill in all fields.");
              }
  </code></pre>
  
  <p>Thank you for your help in advance.</p>