当我尝试向firebase数据库添加数据时没有任何反应
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
database=FirebaseDatabase.getInstance();
reference=database.getReference("comment");
uploadButton=(ImageButton) findViewById(R.id.uploadButton);
uploadButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
reference.setValue("zizo");
}
});
注意:手机已连接到互联网,我写了用户使用互联网的权限
答案 0 :(得分:0)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
DatabaseReference database = FirebaseDatabase.getInstance().getReference().child("comment");
uploadButton=(ImageButton) findViewById(R.id.uploadButton);
uploadButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
reference.setValue("zizo");
}
});