vandana_khargwanshi

Learn & Evaluate by Matching

Learn & Evaluate by Matching Android

Screenshots

Learn & Evaluate by Matching Android
Learn & Evaluate by Matching Android
Learn & Evaluate by Matching Android
Learn & Evaluate by Matching Android
Learn & Evaluate by Matching Android

Specification

How to Use

Sample Code

/** * Get score by group map. * * @param context the context * @param playerName the player name * @param isGroupByPlayer the is group by player * @param id the id * @return the map */ public static Map<String, List<UserScore>> GetScoreByGroup(Context context, String playerName, boolean isGroupByPlayer, int id) { Map<String, List<UserScore>> groupMap = new HashMap<String, List<UserScore>>(); SQLiteDatabase database = SQLiteDatabase.openDatabase(context.getFilesDir() + databaseDirName, null, (int) SQLiteDatabase.OPEN_READONLY); Cursor cursor; String sortBy = null; switch (id) { case R.id.score_sort_time_of_play_radio_button_id: sortBy = timeOfPlayStringStr; break; case R.id.score_sort_time_taken_radio_button_id: sortBy = timeToFinishGameStr; break; case R.id.score_sort_score_radio_button_id: sortBy = scoreStr; break; case R.id.score_sort_play_mode_radio_button_id: sortBy = playModeDisplayStr; break; case R.id.score_sort_failed_attempts_radio_button_id: sortBy = noOfFailedAttemptStr; break; } if (!playerName.isEmpty()) { cursor = database.rawQuery("select * from " + tableName +" where " + playerNameStr + " = '" + playerName + "'" + " order by " + sortBy + " asc", null); } else cursor = database.rawQuery("select * from " + tableName + " order by " + sortBy + " asc", null); String groupName; List<UserScore> userScoreList = null; if (cursor != null && cursor.moveToFirst()) { do { UserScore userScore = new UserScore(cursor.getString(0), cursor.getString(1), cursor.getInt(2), cursor.getString(3), cursor.getString(4), cursor.getString(5), cursor.getInt(6), cursor.getInt(7)); if (isGroupByPlayer) groupName = cursor.getString(1); else groupName = cursor.getString(0); if (groupMap.containsKey(groupName)) { userScoreList = groupMap.get(groupName); } else { userScoreList = new ArrayList<UserScore>(); groupMap.put(groupName, userScoreList); } userScoreList.add(userScore); } while (cursor.moveToNext()); } database.close(); return groupMap; }

Comments (0)

  • {{com.username}}
    {{com.username}}
    Buyer
    Seller

    {{com.username}}

    {{com.ctime}}

    {{com.content}}

    • {{com2.username}}
      {{com2.username}}
      Buyer
      Seller

      {{com2.username}}

      {{com2.ctime}}

      {{com2.content}}