我在应用程序的Java代码中遇到问题
gltf.scene.traverse(child => {
if (child.isMesh && child.name.includes('leaf')) {
child.material.alphaTest = 0.5;
child.material.transparent = true;
}
});
引发错误: @Override
public void onChildAdded(@NonNull DataSnapshot dataSnapshot, @Nullable String s)
{
Message message = dataSnapshot.getValue(Message.class);
message.setKey(dataSnapshot.getKey());
messages.add(message);
displayMessages(messages);
}
答案 0 :(得分:1)
我认为您缺少某些内容,请尝试以下代码:
ref.addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot dataSnapshot, String prevChildKey) {
Post newPost = dataSnapshot.getValue(Post.class);
System.out.println("Author: " + newPost.author);
System.out.println("Title: " + newPost.title);
System.out.println("Previous Post ID: " + prevChildKey);
}
@Override
public void onChildChanged(DataSnapshot dataSnapshot, String prevChildKey) {}
@Override
public void onChildRemoved(DataSnapshot dataSnapshot) {}
@Override
public void onChildMoved(DataSnapshot dataSnapshot, String prevChildKey) {}
@Override
public void onCancelled(DatabaseError databaseError) {}
});
答案 1 :(得分:0)
有时候,我要做的就是。
文件 -使缓存无效/重新启动