File tree Expand file tree Collapse file tree 2 files changed +45
-0
lines changed
app/src/main/java/com/amit Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change 1818 * 2018 May 14 - Monday - 03:05 PM
1919 * This AnimUtil class will help with animation
2020**/
21+ @ SuppressWarnings ("unused" )
2122public class AnimUtil
2223{
2324 private static final String TAG = AnimUtil .class .getSimpleName ();
Original file line number Diff line number Diff line change @@ -331,6 +331,50 @@ public boolean executeDatabaseOperations(String tableName,
331331
332332 // region COMMENTS FOR executeQuery method
333333
334+ /**
335+ * 2018 Feb 01 - Thursday - 03:52 PM
336+ * Execute Select Query
337+ *
338+ * parameters for this method are
339+ *
340+ * @param query - query that you want to execute
341+ *
342+ * @return cursor with records from the table
343+ **/
344+
345+ // endregion COMMENTS FOR executeQuery method
346+ @ SuppressWarnings ("unused" )
347+ public Cursor executeSelectQuery (String query )
348+ {
349+ try
350+ {
351+ // query execution
352+ Cursor cursor = db .getWritableDatabase ().rawQuery (query , null );
353+
354+ // if cursor is not null then moving the position to first
355+ // and returning the cursor
356+ if (cursor != null )
357+ {
358+ cursor .moveToFirst ();
359+ }
360+ else
361+ {
362+ Log .e (TAG , "executeSelectQuery: cursor was null. No data found." );
363+ return null ;
364+ }
365+
366+ return cursor ;
367+ }
368+ catch (Exception e )
369+ {
370+ Log .e (TAG , "executeSelectQuery: in database helper class:\n " );
371+ e .printStackTrace ();
372+ return null ;
373+ }
374+ }
375+
376+ // region COMMENTS FOR executeQuery method
377+
334378 /**
335379 * 2018 Feb 01 - Thursday - 03:52 PM
336380 * Execute Select Query
You can’t perform that action at this time.
0 commit comments