gpt4 book ai didi

android - 异常处理异步线程队列java.lang.UnsupportedOperationException

转载 作者:太空狗 更新时间:2023-10-29 15:23:20 26 4
gpt4 key购买 nike

我在创建字符串数组时遇到问题,这只发生在 2.1 android api 级别 7 或更低版本中,我需要在完全具有此配置的设备上安装应用程序,知道如何解决问题吗?在源代码下方,屏幕上弹出的消息以及 logcat 的消息。

代码:



private String[] fillPedidosName() {
TipoPedidoDAO tipoDAO = null;
try {
tipoDAO = new TipoPedidoDAO();
pedidosList = tipoDAO.selectAll();
String[] temp = new String[pedidosList.size()];
for (int i = 0; i < pedidosList.size(); i++) {
if (pedidosList.get(i) != null) {
temp[i] = pedidosList.get(i).getDescricao().toString();
}
}
return temp;
} catch (Exception ex) {
MyLoger.logar(ex);
return null;
} finally {
if (tipoDAO.getDB().isOpen()) {
tipoDAO.closeConnection();
}
}
}

调试时弹出的消息:

异常处理异步线程队列异常处理异步线程队列java.lang.UnsupportedOperationException

LOGCAT 的消息:

03-03 17:57:57.124: 错误/jdwp(1267): 请求: 不支持 (cmd=2/11 dataLen=8 id=0x0012ba)

最佳答案

您可能没有使用支持 get(int) 的列表。

尝试将您的 List 实现更改为 ArrayList。创建列表时:

列表 myList = new ArrayList()

这可能发生在 tipDAO.selectAll() 中。

关于android - 异常处理异步线程队列java.lang.UnsupportedOperationException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5184776/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com