如何修复ViewRootImpl:Spinner中的sendUserActionEvent()mView == null

时间:2019-01-23 09:36:06

标签: android

旋转器不起作用!!它显示ViewRootImpl:sendUserActionEvent()mView == null。如何解决?

我尝试了不同的方法,但是没有工作

public void onItemSelected(AdapterView parent,View view,int position,long id){         arrayEmailSpinner.clear();

    if (parent.getId() == R.id.spinnerSubjects) {

        Log.e(TAG, subjects[position].toString());
        spinnerValue = subjects[position];
        //Toast.makeText(TutorsListActivity.this, spinnerValue, Toast.LENGTH_SHORT).show();

        if(!spinnerValue.equals("subjects")){
            firebase = new Firebase("https://tutor-778c7.firebaseio.com/tutors");
            firebase.orderByChild("subjectCanTeach").equalTo(spinnerValue).addValueEventListener(new ValueEventListener() {
                @Override
                public void onDataChange(DataSnapshot dataSnapshot) {


                    for (DataSnapshot childSnapshot : dataSnapshot.getChildren()) {
                        Information information = childSnapshot.getValue(Information.class);

                        String name = information.getName();
                        String eq = information.getEducationQualification();
                        String sub = information.getSubjectCanTeach();
                        String image = information.getImage();
                        String email = information.getEmail();
                        // Log.e("name",name);
                        // Log.e("Link",information.getImage());

                        arrayNamesSpinner.add(name);
                        arrayEqSpinner.add(eq);
                        arraySubjectSpinner.add(sub);
                        arrayImageSpinner.add(image);
                        //arrayEmailSpinner.add(email);


                        Log.e("Subject", sub);
                        Log.e("Name", name);

                        if(arrayEmailSpinner.size()>0){
                            final MyCustomAdapter myAdapter = new MyCustomAdapter(TutorsListActivity.this,
                                    arrayNamesSpinner, arrayEqSpinner, arraySubjectSpinner, arrayImageSpinner);

                            myList.setAdapter(myAdapter);
                            myList.setOnItemClickListener(TutorsListActivity.this);
                            myAdapter.notifyDataSetChanged();
                        }
                    }
                }

                @Override
                public void onCancelled(FirebaseError firebaseError) {

                }
            });
        }

        else{
            final MyCustomAdapter myAdapter = new MyCustomAdapter(TutorsListActivity.this,
                    arrayNames, arrayEq, arraySubject, arrayImage);

            myList.setAdapter(myAdapter);
            myList.setOnItemClickListener(TutorsListActivity.this);
            myAdapter.notifyDataSetChanged();
        }

0 个答案:

没有答案