- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我知道有很多像我这样的问题,但我已经阅读并尝试了所有内容,但仍然无法解决这个问题。我想要实现的是用来自 firebase 的数据填充我的 ListView 。我正在关注 youtube 上的教程,但我添加了一些内容,尤其是时间戳。错误在我的 for 循环中并说:
Class java.util.Map has generic type parameters, please use GenericTypeIndicator instead
这是我的数据库:
我的笔记.java
public class Notes {
String noteId;
String noteCategory;
String note;
String rating;
public Map timeStamp;
public Notes(){
}
public Notes(String noteId, String noteCategory, String note, String rating, Map timeStamp) {
this.noteId = noteId;
this.noteCategory = noteCategory;
this.note = note;
this.rating = rating;
this.timeStamp = timeStamp;
}
public String getNoteId() {
return noteId;
}
public String getNoteCategory() {
return noteCategory;
}
public String getNote() {
return note;
}
public String getRating() {
return rating;
}
public Map<String,String> getTimeStamp() { return timeStamp;}
}
下面是我的 NoteList.java
@Override
protected void onStart() {
super.onStart();
databaseNotes.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
notesList.clear();
for(DataSnapshot noteSnapshot : dataSnapshot.getChildren()){
Notes notes = noteSnapshot.getValue(Notes.class);
notesList.add(notes);
}
NoteList adapter = new NoteList(MyNotes.this, notesList);
listViewNotes.setAdapter(adapter);
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
如有任何建议,我们将不胜感激!提前谢谢你。
编辑:好的,我尝试了建议的答案,在我记录 map 后,它在控制台上显示了我的数据。但是,如何将我的 map 迭代到 ListView 中?
Map<String, Object> map = (Map<String, Object>) dataSnapshot.getValue();
最佳答案
从您的数据库来看,您似乎应该使用 int
或 long
类型而不是 map
类型,因为您的时间戳有一个数值
关于java - Android - 类 java.util.Map 具有通用类型参数,请改用 GenericTypeIndicator,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49767344/
所以,我有一个 Python 脚本,基本上可以写入 80GB 以上的文件。目前它只是串行运行,在服务器上运行大约需要 13 个小时,这是我唯一一次实际运行它。 我打算将它并行化,以便它写入多个文件,而
我最近将 ASP.Net Web API 项目部署到我们的 Azure 应用服务测试槽,但在向 API 端点发出请求时开始收到错误。通过远程调试,很明显该应用正在从部署的 web.config 文件中
为什么我在 android 的 xml 布局中有这个警告消息 信息是避免使用“px”作为单位,改用“dp” 最佳答案 答案就在那里:What is the difference between "px
我正在使用 Symfony 2.3,并且在我的分析器中有与 Twig 相关的弃用警告。如: DEPRECATION - Using "replace" with character by charac
这个问题在这里已经有了答案: Convert pandas dataframe to NumPy array (15 个答案) 关闭 3 年前。 我有以下代码 train_X, test_X, tr
我正在尝试在 Storyboard完成后运行一些代码,但似乎找不到如何设置它...如果我只是这样做 Completed="LoadingStoryBoard_Completed" 在 Storyboa
我最近使用 ng update 更新了我的 Angular 版本并且在运行 ng lint 时 我收到错误 create is deprecated: use new Observable() ins
我将 webpacker 从 4.x 升级到 5.2.1 并开始收到此警告: The resolved_paths option has been deprecated. Use additional
我正在编译一些 C 代码,但出现错误 typedef 'A' is initialized (use decltype instead) 在我的结构声明之一。什么可能导致这种情况? 最佳答案 我可以用
打开 GUI 的简单程序,单击一个按钮设置 curDir,单击另一个按钮设置 savDir,第三个按钮执行一些 C++ 代码,类似于 ls -l curDir > savDir.txt 我的一个 Qt
我要git diff成为一个快速的命令行解决方案来查看两个文件之间的差异,然后我想要 git difftool启动 meld 以获得文件差异的更多图形 View 。 目前,git diff完全按照我的
我正在尝试构建一个 webpack 解析器,下面的 .plugin 方法代码似乎已被弃用,我找不到使用 .hooks 的类似方法调用。 module.exports = class Resolver
我最近在运行我的应用程序时开始收到此错误。它似乎不会影响一切,但它在日志中非常嘈杂和烦人。我没有对我的应用程序进行任何更改或添加任何会导致此类问题的内容,我最近所做的唯一一件事就是升级到最新版本的 F
我想用 Python mongodb 查询,但“DeprecationWarning: count is deprecated。改用 Collection.count_documents。”给出这样的
代码: export default { props: { article: {type: Object} }, data () { retur
这让我发疯。我想读取一些文本文件(位于我的项目目录之外),用 Windows-1252 编码,将它们编辑为字符串,然后写回这些文件,再次作为 Windows-1252。然而,Visual Studio
我需要一点帮助。因为 preg_replace 已弃用,我必须将所有 my preg_replace 转换为 preg_replace_callback... 我尝试过的: 改变: $template
简短的例子: #include #include using namespace boost; template BOOST_TYPEOF_TPL(T() + U()) add2(const T&
我尝试运行 Vuetify VueJS Cordova example但是在 npm run dev 之后出现了这个错误 node build/dev-server.js Starting dev s
我有以下代码: func setupShortcutItems(launchOptions: [NSObject: AnyObject]?) -> Bool { var shouldPerfo
我是一名优秀的程序员,十分优秀!