我的数据库安排如下 我希望能够在单击按钮时显示在TextView中更新的下一行的值。 这是我的代码示例
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_quotes);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setTitle("Transformation Quote");
Firebase.setAndroidContext(this);
mFirebase = new Firebase("https://transformation-hour.firebaseio.com/Quotes");
quoteText= (TextView)findViewById(R.id.quote_text);
quoteId = (TextView)findViewById(R.id.id_number);
mFirebase.addValueEventListener(new com.firebase.client.ValueEventListener() {
@Override
public void onDataChange(com.firebase.client.DataSnapshot dataSnapshot) {
String value = dataSnapshot.getValue(String.class);
quoteText.setText(value);
}
@Override
public void onCancelled(FirebaseError firebaseError) {
}
});
}