Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

Save SQLite returned data to an object list

public void fillDataToArray() {

            ArrayList<BeanClass> arrayList = new ArrayList<BeanClass>();
            DatabaseHandler db = new DatabaseHandler(getActivity());
            db.open();
            try
        {
            Cursor c = db.getImageNameForList();

                if (c != null && c.getCount() > 0) {
                c.moveToFirst();
                for (int count = 0; count < c.getCount(); count++) {
                     Beanclass detail = new Beanclass ();

                     detail.setName(c.getString(c
                     .getColumnIndex(DatabaseHandler._ID)));

                     detail.setPath(c.getString(c
                     .getColumnIndexOrThrow(DatabaseHandler._PATH)));

                     arrayList.add(detail);
                    c.moveToNext();

                    }
                }
        }
    catch(Exception e)
        {
        e.printStackTrace();
        }
            c.close();
            db.close();

        }
Comment

PREVIOUS NEXT
Code Example
Java :: how to add element in java arraylit syntax in gfg 
Java :: java k jump 
Java :: serilize filke in java 
Java :: find namestart with name using strim in java 
Java :: how to disable the auto-configuration? 
Java :: api for currency conversion free 
Java :: if(ResultSet.next()) 
Java :: Duplicate entry Exception 
Java :: sethomebutton listener android 
Java :: javafx character counter 
Java :: get action command in java 
Java :: java page setup 
Java :: java code file 
Java :: java completablefuture chain 2 operations 
Java :: javafx.controls,javafx.fxml caused by: java.lang.classnotfoundexception: javafx.controls,javafx.fxml 
Java :: how to insert a char at n position java 
Java :: if (copy = 5) { in java 
Java :: jumping sequence java boolean values 
Java :: truncar a 2 decimales java 
Java :: array remove duplicate in java 
Java :: can abstract class have constructor in java 
Java :: java find duplicates in array 
Java :: android array to string 
Java :: mp3 player java 
Java :: how to sprint minecraft java 
Java :: android studio random number between 1 and 10 
Java :: print outputstream to console java 
Java :: grepper mcm java 
Sql :: postgres get size of database 
Sql :: mysql now format 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =