Android 通知收件箱ParseQueryAdapter空指针错误
我已经为一个应用程序编写了一个通知收件箱选项卡,最初有一个硬编码的通道返回到我的listview。发送的每个推送通知也将保存在通知表中,并保存通道和消息。由于不是每个用户都将使用同一个频道,因此我尝试进行查询,将CurrentInstallation的channelsInstallation表与Notification tables channels字段进行比较。目标是用消息填充列表项 这就是我所拥有的Android 通知收件箱ParseQueryAdapter空指针错误,android,parse-platform,Android,Parse Platform,我已经为一个应用程序编写了一个通知收件箱选项卡,最初有一个硬编码的通道返回到我的listview。发送的每个推送通知也将保存在通知表中,并保存通道和消息。由于不是每个用户都将使用同一个频道,因此我尝试进行查询,将CurrentInstallation的channelsInstallation表与Notification tables channels字段进行比较。目标是用消息填充列表项 这就是我所拥有的 ParseQueryAdapter<ParseObject> notificat
ParseQueryAdapter<ParseObject> notificationAdapter =
new ParseQueryAdapter<ParseObject>(getActivity(), new ParseQueryAdapter.QueryFactory<ParseObject>() {
public ParseQuery<ParseObject> create() {
ParseQuery query = new ParseQuery("Notifications");
query.whereEqualTo("channels", ParseInstallation.getCurrentInstallation().getList("channels"));
query.orderByDescending("createdAt");
return query;
}
});
notificationAdapter.setTextKey("msg");
ListView notificationListView = (ListView) getActivity().findViewById(R.id.notificationListView);
notificationListView.setAdapter(notificationAdapter);
线路
我有一个安装通道测试条目。
我有3个通道测试通知条目
我不确定我做错了什么 请检查notificationListView是否在该片段的根视图中,或者notificationAdapter中的某些值是否不存在。这2种情况可能会导致该行出现空指针异常。您可能不想将equalTo用于通道约束。。Where contained in可能是赢家,但考虑到你所犯的错误,你可能有其他错误。Where contained in是拼图的一部分,谢谢你的OotView,Where contained in回答了我的问题。谢谢你的帮助。
notificationListView.setAdapter(notificationAdapter);