Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public ArrayList<Movie> query(){
- ArrayList<Movie> arrayList = new ArrayList<Movie>();
- Cursor cursor = database.query(DATABASE_TABLE,
- null,
- null,
- null,
- null,
- null,
- _ID +" DESC",null);
- cursor.moveToFirst();
- Movie movie;
- if (cursor.getCount()>0) {
- do {
- movie = new Movie();
- movie.setId(cursor.getInt(cursor.getColumnIndexOrThrow(_ID)));
- movie.setMovieTitle(cursor.getString(cursor.getColumnIndexOrThrow(TITLE)));
- movie.setMovieDesc(cursor.getString(cursor.getColumnIndexOrThrow(DESCRIPTION)));
- movie.setMovieDate(cursor.getString(cursor.getColumnIndexOrThrow(DATE)));
- movie.setMovieImage(cursor.getString(cursor.getColumnIndexOrThrow(PHOTO)));
- arrayList.add(movie);
- cursor.moveToNext();
- } while (!cursor.isAfterLast());
- }
- cursor.close();
- return arrayList;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement