0

When I run my app in console I've got this error:

To much output to process

static void* NetworkCommunication::ReadThreadProc(void*) -- 477: epoll_wait() unexpected error: Invalid argument

and

I/Choreographer: Skipped 58 frames! The application may be doing too much work on its main thread.

I have a Project.class and 4 activities which use this class as a model class. 3 classes work perfectly but one (the same but other names of strings) is crashing and come back to MainActivity. One day worked correctly but this day is crashed. Only when is connected to Firebase. When my app is offline nothing shows, so it works.

Project.class:

    public String title;  
    public String place;
    public String date;  


    public Project(){

    }

    public Project(String title, String place, String date ){

        this.title = title;
        this.place = place;
        this.date = date;
    }

    public String getTitle() {
        return title;
    }
    public String getPlace() {
        return place;
    }


    public String getDate() {
        return date;
    }


}

Activity:

    private Adapter adapter;
    private ListView listView;
    private DatabaseReference reference;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity);

        listView = (ListView) findViewById(R.id.list);
        adapter = new Adapter(this, R.id.list);
        listView.setAdapter(adapter);

        FirebaseDatabase database = FirebaseDatabase.getInstance();
        reference = database.getReference("database");

        reference.addChildEventListener(new com.google.firebase.database.ChildEventListener() {
            @Override
            public void onChildAdded(com.google.firebase.database.DataSnapshot dataSnapshot, String s) {

                Project msg = dataSnapshot.getValue(Project.class);
                adapter.add(msg);
                adapter.notifyDataSetChanged();

            }

            @Override
            public void onChildChanged(com.google.firebase.database.DataSnapshot dataSnapshot, String s) {

            }

            @Override
            public void onChildRemoved(com.google.firebase.database.DataSnapshot dataSnapshot) {

            }

            @Override
            public void onChildMoved(com.google.firebase.database.DataSnapshot dataSnapshot, String s) {

            }

            @Override
            public void onCancelled(DatabaseError databaseError) {

            }
        });

        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Project selectedList = adapter.getItem(position);
                if (selectedList != null) {

                    Intent intent = new Intent(Activity.this, Details_Project_Activity.class);


                    intent.putExtra(Constants.KEY_LIST_TITLE, selectedList.getTitle());
                    intent.putExtra(Constants.KEY_LIST_PLACE, selectedList.getPlace());
                    intent.putExtra(Constants.KEY_LIST_DATE, selectedList.getDate());

                    startActivity(intent);
                }
            }
        });
    }

I have Activity2 and Activity3 also the same with changed particular names of variables and database name and it works. Only in this class it doesn't work. In database names are the same. So, it should work.

It this error, at the beggining, can cause this problem? Could somebody help me to resolve this situation?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
gryzek
  • 537
  • 9
  • 25
  • See http://stackoverflow.com/questions/14678593/the-application-may-be-doing-too-much-work-on-its-main-thread (the first result when I search for the error message). – Frank van Puffelen Aug 28 '16 at 22:03
  • @FrankvanPuffelen Yes, I read it. I have some small images to 2 KB. This error occurs all the time. But when database is empty activity doesn't close. This one fail Activity doesn't work when I try to put something to database and read it. – gryzek Aug 28 '16 at 22:13
  • This Activity started work properly. I had a mistake in layout.xml. I lost "a" in "RelatiiveLayout" name. It caused this bug. Thanks. – gryzek Aug 29 '16 at 07:48

0 Answers0