我尝试寻找答案,但没有任何效果,但我相信这段代码是有问题的,调试器说
这是我的文件的链接:TodoListApp
跳过 1 帧!应用程序可能在其主线程上做了太多工作
// working with data
ourdoes = findViewById(R.id.ourdoes);
ourdoes.setLayoutManager(new LinearLayoutManager(this));
list = new ArrayList<MyDoes>();
// get data from firebase
reference = FirebaseDatabase.getInstance().getReference().child("SeaLab13");
reference.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
// set code to retrive data and replace layout
for(DataSnapshot dataSnapshot1: dataSnapshot.getChildren())
{
MyDoes p = dataSnapshot1.getValue(MyDoes.class);
list.add(p);
}
doesAdapter = new DoesAdapter(MainActivity.this, list);
ourdoes.setAdapter(doesAdapter);
doesAdapter.notifyDataSetChanged();
}
@Override
public void onCancelled(DatabaseError databaseError) {
// set code to show an error
Toast.makeText(getApplicationContext(), "No Data", Toast.LENGTH_SHORT).show();
}
});
猛跑小猪
相关分类