Search in sources :

Example 1 with Utils

use of com.ichi2.libanki.Utils in project AnkiChinaAndroid by ankichinateam.

the class Collection method nextID.

/**
 * Utils ******************************************************************** ***************************
 */
public int nextID(String type) {
    type = "next" + Character.toUpperCase(type.charAt(0)) + type.substring(1);
    int id;
    try {
        id = mConf.getInt(type);
    } catch (JSONException e) {
        id = 1;
    }
    mConf.put(type, id + 1);
    return id;
}
Also used : JSONException(com.ichi2.utils.JSONException) SuppressLint(android.annotation.SuppressLint)

Example 2 with Utils

use of com.ichi2.libanki.Utils in project Anki-Android by ankidroid.

the class Collection method nextID.

/**
 * Utils ******************************************************************** ***************************
 */
public int nextID(String type) {
    type = "next" + Character.toUpperCase(type.charAt(0)) + type.substring(1);
    int id;
    try {
        id = get_config_int(type);
    } catch (JSONException e) {
        Timber.w(e);
        id = 1;
    }
    set_config(type, id + 1);
    return id;
}
Also used : JSONException(com.ichi2.utils.JSONException) SuppressLint(android.annotation.SuppressLint)

Aggregations

SuppressLint (android.annotation.SuppressLint)2 JSONException (com.ichi2.utils.JSONException)2