Async thread queue java.lang.UnsupportedOperationException exception handling

I had a problem when I create an array of strings, this only happens in 2.1 android api level 7 or lower, and I need to install the application on a device with this configuration, any idea how to solve the problem? A message appears on the screen below the source code, as well as a logcat message.

CODE:



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();
        }
    }
}

MESSAGE THAT ALLOWS TO DISABLE:

Asynchronous exception handling queue handling Asynchronous exception handling queue processing java.lang.UnsupportedOperationException

MESSAGE lOGCAT:

03-03 17: 57: 57.124: ERROR / jdwp (1267): REQ: UNSUPPORTED (cmd = 2/11 dataLen = 8 id = 0x0012ba)

+3
source share
2 answers

, , get (int).

List ArrayList. :

List myList = new ArrayList()

, , tipDAO.selectAll().

0

. . , .

List<Prediction> predictions = new ArrayList<Prediction>();

. . .

com.thuptencho.torontotransitbus.models;

public class Prediction {
    public String epochTime = "", seconds = "", minutes = "", isDeparture = "", affectedByLayover = "", branch = "",
            dirTag = "", vehicle = "", block = "", tripTag = "";
    //this constructor was missing..after coding this constructor. the error was gone.
    public Prediction(){
        super();
    }
    @Override
    public String toString() {
        return "epochTime:" + this.epochTime + " seconds:" + this.seconds + " minutes:" + this.minutes
                + " isDeparture:" + this.isDeparture + " affectedByLayover:" + this.affectedByLayover + " branch:"
                + this.branch + " dirTag:" + this.dirTag + " vehicle:" + this.vehicle + " block:" + this.block
                + " triptag:" + this.tripTag;
    }
}
0

Source: https://habr.com/ru/post/1796114/


All Articles