android - ORMLite get Could not get next result for class Error -


i'm using ormlite library in android , error random , dont know whats , how modrate:

caused by: java.lang.illegalstateexception: not next result class [ljava.lang.string;             @ com.j256.ormlite.stmt.selectiterator.next 

i error when i'm using method single column :

    public static list getsinglecolumn(string query) {         list<string> columnes = null;         try {             columnes = g.category.queryraw(query, new rawrowmapper<string>() {                 @override                 public string maprow(string[] columnnames, string[] resultcolumns) throws android.database.sqlexception {                     return resultcolumns[0];                 }             }).getresults();         } catch (sqlexception e) {             e.printstacktrace();         }         return columnes;     } 

or code:

list unread_messages = g.dbhelper.getsinglecolumn("select sum(read_status) messageslist"); 

try change method this:

public static string getsinglecolumn(string query) {     string columnes = null;     try {         columnes = g.category.queryraw(query, new rawrowmapper<string>() {             @override             public string maprow(string[] columnnames, string[] resultcolumns) throws android.database.sqlexception {                 return resultcolumns[0];             }         }).getfirstresult();     } catch (sqlexception e) {         e.printstacktrace();     }     return columnes; } 

Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -