【发布时间】:2016-11-12 02:24:34
【问题描述】:
当我尝试使用 firebase UI 使用 firebase 适配器填充列表视图时收到这些错误
com.google.firebase.database.DatabaseException:转换失败 java.util.HashMap 类型的值到 String com.google.firebase.database.DatabaseException:类 java.util.HashMap 有泛型类型参数,请使用 而是 GenericTypeIndicator
这里是代码
DatabaseReference ref = FirebaseDatabase.getInstance().getReference();
DatabaseReference a = ref.child("info");
final FirebaseListAdapter<String> adapter =
new FirebaseListAdapter<String>(this,String.class,android.R.layout.simple_list_item_1,a) {
@Override
protected void populateView(View v, String model, int position) {
TextView text = (TextView) findViewById(android.R.id.text1);
text.setText(model);
}
这里是一个json数据的例子
"info" : {
"KSTUJILdwPN305Fs7ujhga4knlG3" : {
"File Info" : {
"-JFRkA855rfOU7GtcK4" : {
"Name" : "John",
"Adress" : "Test Adress",
"Favourite_food" : "Bread",
},
【问题讨论】:
-
您能否在
a位置显示一个 JSON 的小示例(作为文本,请不要截图)?您可以通过从 Firebase 数据库控制台导出它来获取它。 -
好的,我用 json 数据示例更新了问题
标签: java android listview firebase-realtime-database firebaseui