你能帮我找出为什么我的代码不起作用吗?我想rate在 Firebase 中检索孩子的值并将其显示在我EditText的 Android Studio 中。然后,当在EditTextvia 中输入另一个值时button,子项的值rate将被更新。谢谢。
package com.example.jordan.grat;
import ...
public class AdminActivity extends AppCompatActivity {
private Button mLogout, mAddDriver, mEditDriver, mUpdateRate;
private DatabaseReference mAdminDatabase;
private EditText mRateField;
private String mRate, mPassword;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_admin);
mLogout = (Button) findViewById(R.id.logout);
mAddDriver = (Button) findViewById(R.id.addDriver);
mEditDriver = (Button) findViewById(R.id.editDriver);
mUpdateRate = (Button) findViewById(R.id.updateRate);
mRateField = (EditText) findViewById(R.id.rateField);
mAdminDatabase = FirebaseDatabase.getInstance().getReference().child("Users").child("Admins");
getRate();
mAddDriver.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(AdminActivity.this, AddDriverActivity.class);
startActivity(intent);
finish();
return;
}
});
mEditDriver.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
}
});
mLogout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(AdminActivity.this, MainActivity.class);
startActivity(intent);
finish();
return;
}
});
mUpdateRate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
setRate();
}
});
}
抱歉,我还是 Android Studio 的初学者。任何帮助,将不胜感激。我的火力基地:
慕妹3242003
牛魔王的故事
12345678_0001
相关分类