Backendless Support
 
Waiting for user's response

Error of editing the info displayed on the list view

Heyy...

Im having a with editing the information on the listView wen i click the list view entry it goes on to the editing activity but it doesn't view the information that i clicked

have attatched my code below

Files: edit.txt
Leave a Comment

Comments (10)

photo
1

Hi Nomfundo

Could you please point out the line in your code where you have a problem?

Your code is:

  1. String whereClause = "ownerId ='"+ Backendless.UserService.loggedInUser()+"'";
  2. DataQueryBuilder dataQuery = DataQueryBuilder.create();
  3. dataQuery.setWhereClause(whereClause.toString());
  4. dataQuery.setPageSize(100).setOffset(0);
  5. Toast.makeText(this, getIntent().getStringExtra("ownerId"), Toast.LENGTH_SHORT).show();
  6. Backendless.Persistence.of(AppointmentsData.class).find(dataQuery, new AsyncCallback<List<AppointmentsData>>() {
  7. @Override
  8. public void handleResponse(List<AppointmentsData> lshow) {
  9. for (int x = 0; x < lshow.size(); x++) {
  10. fetch = x;
  11. }
  12. editAppointment = lshow;
  13. ediCon.setText(lshow.get(fetch).getConsultant());
  14. ediTele.setText(lshow.get(fetch).getTelemarketer());
  15. ediDate.setText(lshow.get(fetch).getAppointmentDate());
  16. ediDay.setText(lshow.get(fetch).getDay());
  17. ediTime.setText(lshow.get(fetch).getTime());
  18. ediName.setText(lshow.get(fetch).getName());
  19. ediSurname.setText(lshow.get(fetch).getSurname());
  20. ediCell.setText(lshow.get(fetch).getCell());
  21. ediHome.setText(lshow.get(fetch).getHomeNumber());
  22. ediWork.setText(lshow.get(fetch).getWorkNumber());
  23. ediOccu.setText(lshow.get(fetch).getOccuption());
  24. ediCamp.setText(lshow.get(fetch).getCompany());
  25. ediPhyscal.setText(lshow.get(fetch).getPhysicalAddress1());
  26. ediPhysical1.setText(lshow.get(fetch).getPhysicalAddress2());
  27. ediBuild.setText(lshow.get(fetch).getBuilding());
  28. ediBlock.setText(lshow.get(fetch).getBlock());
  29. ediFloor.setText(lshow.get(fetch).getFloor());
  30. ediStreet.setText(lshow.get(fetch).getStreet());
  31. ediNear.setText(lshow.get(fetch).getNearestCorner());
  32. ediSub.setText(lshow.get(fetch).getSuburb());
  33. // edId.setText(lshow.get(fetch).getOwnerId());
  34. }

Is the "lshow" list not empty?

Do you have an issue with it:

  1. ediCon.setText(lshow.get(fetch).getConsultant());
  2. ediTele.setText(lshow.get(fetch).getTelemarketer());
  3. ediDate.setText(lshow.get(fetch).getAppointmentDate());
  4. ediDay.setText(lshow.get(fetch).getDay());
  5. ediTime.setText(lshow.get(fetch).getTime());
  6. ediName.setText(lshow.get(fetch).getName());
  7. ediSurname.setText(lshow.get(fetch).getSurname());
  8. ediCell.setText(lshow.get(fetch).getCell());
  9. ediHome.setText(lshow.get(fetch).getHomeNumber());
  10. ediWork.setText(lshow.get(fetch).getWorkNumber());
  11. ediOccu.setText(lshow.get(fetch).getOccuption());
  12. ediCamp.setText(lshow.get(fetch).getCompany());
  13. ediPhyscal.setText(lshow.get(fetch).getPhysicalAddress1());
  14. ediPhysical1.setText(lshow.get(fetch).getPhysicalAddress2());
  15. ediBuild.setText(lshow.get(fetch).getBuilding());
  16. ediBlock.setText(lshow.get(fetch).getBlock());
  17. ediFloor.setText(lshow.get(fetch).getFloor());
  18. ediStreet.setText(lshow.get(fetch).getStreet());
  19. ediNear.setText(lshow.get(fetch).getNearestCorner());
  20. ediSub.setText(lshow.get(fetch).getSuburb());

Regards, Vlad

photo
1

Morning

My whereclause this is my error "java.lang.IndexOutOfBoundsException: Index: 0, Size: 0

at java.util.ArrayList.get(ArrayList.java:411)

at com.example.hellen.xchngeinvestmenttraining.EditMaster$1.handleResponse(EditMaster.java:104)

at com.example.hellen.xchngeinvestmenttraining.EditMaster$1.handleResponse(EditMaster.java:97)"

im trying to show the person i clicked on my list view on the edit activity so that i can be able to edit the information of that person

  1. String whereClause = "name ='"+ getIntent().getStringExtra("objectId")+"'";DataQueryBuilder dataQuery = DataQueryBuilder.create();
  2. dataQuery.setWhereClause(whereClause.toString());
  3. dataQuery.setPageSize(100).setOffset(0);

photo
1

where does the error "java.lang.IndexOutOfBoundsException: Index: 0, Size: 0

at java.util.ArrayList.get(ArrayList.java:411)" come from?

photo
1

maybe you should use "objectId" instead of "name" in the whereClause

  1. String whereClause = "objectId ='"+ getIntent().getStringExtra("objectId")+"'";

or use findById method https://backendless.com/docs/android/doc.html#data_basic_search

  1. public void Backendless.Data.of( "TABLE-NAME" ).findById( String objectId, AsyncCallback<Map> responder )

photo
1

still giving me errors

photo
1

please share with us a minimal code snippet for reproduce your problem

photo
1

below i have attached a screen shot of the list view and the whole edit class

photo
photo
1

and my list is not empty i didnt send all the code

photo
1

Note that you're loading the data asynchronously, so there is some delay between sending the request and filling your results list. So at some moment your list is empty.

photo
photo
1

Hi, Nomfundo Ngwenya

Unfortunately our support policy does not cover debugging of users' applications. The error you've posted doesn't seem like a problem related to Backendless APIs. As Vladimir Upirov mentioned - you may want to share a minimal verifiable code sample/project which we can run and indicate the problem

Anton