public List<ShotChartCoords> getAllPlayerShots(long p_id) { if (_local) { SQLiteDatabase db = this.getReadableDatabase(); List<ShotChartCoords> shots = new ArrayList<ShotChartCoords>(); String selectQuery = "SELECT * FROM " + TABLE_SHOT_CHART_COORDS + "WHERE " + KEY_P_ID + " = " + p_id; Log.i(LOG, selectQuery); Cursor c = db.rawQuery(selectQuery, null); if (c != null && c.moveToFirst()) { do { // create the instance of Players using cursor information ShotChartCoords shot = new ShotChartCoords(); shot.setshotid(c.getLong(c.getColumnIndex(KEY_SHOT_ID))); shot.setgid((c.getLong(c.getColumnIndex(KEY_G_ID)))); shot.setpid((c.getLong(c.getColumnIndex(KEY_P_ID)))); shot.settid((c.getLong(c.getColumnIndex(KEY_T_ID)))); shot.setx((c.getInt(c.getColumnIndex(KEY_X)))); shot.sety((c.getInt(c.getColumnIndex(KEY_Y)))); shot.setmade((c.getString(c.getColumnIndex(KEY_MADE)))); // adding to players list shots.add(shot); } while (c.moveToNext()); } return shots; } else { return _net.getAllPlayerShots(p_id); } }