Support Topics Documentation Slack YouTube Blog

Getting java.lang.runtimeException & java.lang.NullPointerException while defining relation

I am trying to create a relation between 2 columns but getting the error I have already defined in the Backendless about the relation column

here is my code

     StudentPersonalTeachers studentPersonalTeachers = new 
     StudentPersonalTeachers();

                    studentPersonalTeachers.setTeacherName(TT_Name);
                    studentPersonalTeachers.setTeacherImageUrl(TT_ImageURL);
                    studentPersonalTeachers.setTeacherOwnerId(TT_OwnerId);


                    final ArrayList<StudentPersonalTeachers> userInfoCollection = new ArrayList<StudentPersonalTeachers>();
                    userInfoCollection.add( studentPersonalTeachers );

                    Backendless.Persistence.save(studentPersonalTeachers, new AsyncCallback<StudentPersonalTeachers>() {
                        @Override
                        public void handleResponse(StudentPersonalTeachers response) {

     StudentInformation studentInformation = new StudentInformation() ;

                          Backendless.Data.of( StudentInformation.class ).setRelation(studentInformation, "studentPersonalTeacher", userInfoCollection,
                                    new AsyncCallback<Integer>() {
                                        @Override
                                        public void handleResponse(Integer response) {

                                            Toast.makeText(AddTeacher.this, "Relation Created", Toast.LENGTH_SHORT).show();

                                            // now update the specific entry OKAY based on Information



                                        }

                                        @Override
                                        public void handleFault(BackendlessFault fault) {
                                            Toast.makeText(AddTeacher.this, fault.getMessage(), Toast.LENGTH_SHORT).show();

                                        }
                                    }); 

 @Override
                        public void handleFault(BackendlessFault fault) {


                            cardViewButton.setVisibility(View.VISIBLE);
                            progressBar.setVisibility(View.INVISIBLE);
                            cardViewOfTeacherNameHeading.setEnabled(true);
                            fourthEditText.setEnabled(true);

                            Toast.makeText(AddTeacher.this, tryAgain, Toast.LENGTH_SHORT).show();

                        }
                    });

Hello,

  1. Which line specifically is causing an exception?
  2. What does the exception say?

Regards,
Mark

Hey @Saad_Zahoor1

Did you manage to find a solution to the problem you’ve described?

Anton