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

edit.txt (2.09kB)

Hi Nomfundo

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

Your code is:


 String whereClause = "ownerId ='"+ Backendless.UserService.loggedInUser()+"'";
        DataQueryBuilder dataQuery = DataQueryBuilder.create();
        dataQuery.setWhereClause(whereClause.toString());
        dataQuery.setPageSize(100).setOffset(0);


        Toast.makeText(this, getIntent().getStringExtra("ownerId"), Toast.LENGTH_SHORT).show();
        Backendless.Persistence.of(AppointmentsData.class).find(dataQuery, new AsyncCallback<List<AppointmentsData>>() {
            @Override
            public void handleResponse(List<AppointmentsData> lshow) {
                for (int x = 0; x < lshow.size(); x++) {
                    fetch = x;
                }
                editAppointment = lshow;
                ediCon.setText(lshow.get(fetch).getConsultant());
                ediTele.setText(lshow.get(fetch).getTelemarketer());
                ediDate.setText(lshow.get(fetch).getAppointmentDate());
                ediDay.setText(lshow.get(fetch).getDay());
                ediTime.setText(lshow.get(fetch).getTime());
                ediName.setText(lshow.get(fetch).getName());
                ediSurname.setText(lshow.get(fetch).getSurname());
                ediCell.setText(lshow.get(fetch).getCell());
                ediHome.setText(lshow.get(fetch).getHomeNumber());
                ediWork.setText(lshow.get(fetch).getWorkNumber());
                ediOccu.setText(lshow.get(fetch).getOccuption());
                ediCamp.setText(lshow.get(fetch).getCompany());
                ediPhyscal.setText(lshow.get(fetch).getPhysicalAddress1());
                ediPhysical1.setText(lshow.get(fetch).getPhysicalAddress2());
                ediBuild.setText(lshow.get(fetch).getBuilding());
                ediBlock.setText(lshow.get(fetch).getBlock());
                ediFloor.setText(lshow.get(fetch).getFloor());
                ediStreet.setText(lshow.get(fetch).getStreet());
                ediNear.setText(lshow.get(fetch).getNearestCorner());
                ediSub.setText(lshow.get(fetch).getSuburb());
              // edId.setText(lshow.get(fetch).getOwnerId());


            }
 

Is the “lshow” list not empty?
Do you have an issue with it:


ediCon.setText(lshow.get(fetch).getConsultant());
                ediTele.setText(lshow.get(fetch).getTelemarketer());
                ediDate.setText(lshow.get(fetch).getAppointmentDate());
                ediDay.setText(lshow.get(fetch).getDay());
                ediTime.setText(lshow.get(fetch).getTime());
                ediName.setText(lshow.get(fetch).getName());
                ediSurname.setText(lshow.get(fetch).getSurname());
                ediCell.setText(lshow.get(fetch).getCell());
                ediHome.setText(lshow.get(fetch).getHomeNumber());
                ediWork.setText(lshow.get(fetch).getWorkNumber());
                ediOccu.setText(lshow.get(fetch).getOccuption());
                ediCamp.setText(lshow.get(fetch).getCompany());
                ediPhyscal.setText(lshow.get(fetch).getPhysicalAddress1());
                ediPhysical1.setText(lshow.get(fetch).getPhysicalAddress2());
                ediBuild.setText(lshow.get(fetch).getBuilding());
                ediBlock.setText(lshow.get(fetch).getBlock());
                ediFloor.setText(lshow.get(fetch).getFloor());
                ediStreet.setText(lshow.get(fetch).getStreet());
                ediNear.setText(lshow.get(fetch).getNearestCorner());
                ediSub.setText(lshow.get(fetch).getSuburb());

Regards, Vlad

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

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

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

where does the error “java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.get(ArrayList.java:411)” come from?

maybe you should use “objectId” instead of “name” in the whereClause

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

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

public void Backendless.Data.of( "TABLE-NAME" ).findById( String objectId,                                                                  AsyncCallback&lt;Map&gt; responder )

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.

still giving me errors

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

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

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