Android Studio错误“无法解决方法”

时间:2019-05-27 22:41:29

标签: java android xml

我在应用程序的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); }

2 个答案:

答案 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)

有时候,我要做的就是。

文件 -使缓存无效/重新启动