Java Code Examples for org.json.JSONObject.equals()

The following are Jave code examples for showing how to use equals() of the org.json.JSONObject class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: localcloud_fe   File: NetworkManager.java   View Source Code Vote up 6 votes
/**
 * Updates the JavaScript side whenever the connection changes
 *
 * @param info the current active network info
 * @return
 */
private void updateConnectionInfo(NetworkInfo info) {
    // send update to javascript "navigator.network.connection"
    // Jellybean sends its own info
    JSONObject thisInfo = this.getConnectionInfo(info);
    if(!thisInfo.equals(lastInfo))
    {
        String connectionType = "";
        try {
            connectionType = thisInfo.get("type").toString();
        } catch (JSONException e) {
            LOG.d(LOG_TAG, e.getLocalizedMessage());
        }

        sendUpdate(connectionType);
        lastInfo = thisInfo;
    }
}
 
Example 2
Project: localcloud_fe   File: NetworkManager.java   View Source Code Vote up 6 votes
/**
 * Updates the JavaScript side whenever the connection changes
 *
 * @param info the current active network info
 * @return
 */
private void updateConnectionInfo(NetworkInfo info) {
    // send update to javascript "navigator.network.connection"
    // Jellybean sends its own info
    JSONObject thisInfo = this.getConnectionInfo(info);
    if(!thisInfo.equals(lastInfo))
    {
        String connectionType = "";
        try {
            connectionType = thisInfo.get("type").toString();
        } catch (JSONException e) {
            LOG.d(LOG_TAG, e.getLocalizedMessage());
        }

        sendUpdate(connectionType);
        lastInfo = thisInfo;
    }
}
 
Example 3
Project: localcloud_fe   File: NetworkManager.java   View Source Code Vote up 6 votes
/**
 * Updates the JavaScript side whenever the connection changes
 *
 * @param info the current active network info
 * @return
 */
private void updateConnectionInfo(NetworkInfo info) {
    // send update to javascript "navigator.network.connection"
    // Jellybean sends its own info
    JSONObject thisInfo = this.getConnectionInfo(info);
    if(!thisInfo.equals(lastInfo))
    {
        String connectionType = "";
        try {
            connectionType = thisInfo.get("type").toString();
        } catch (JSONException e) {
            LOG.d(LOG_TAG, e.getLocalizedMessage());
        }

        sendUpdate(connectionType);
        lastInfo = thisInfo;
    }
}
 
Example 4
Project: siiMobilityAppKit   File: NetworkManager.java   View Source Code Vote up 6 votes
/**
 * Updates the JavaScript side whenever the connection changes
 *
 * @param info the current active network info
 * @return
 */
private void updateConnectionInfo(NetworkInfo info) {
    // send update to javascript "navigator.network.connection"
    // Jellybean sends its own info
    JSONObject thisInfo = this.getConnectionInfo(info);
    if(!thisInfo.equals(lastInfo))
    {
        String connectionType = "";
        try {
            connectionType = thisInfo.get("type").toString();
        } catch (JSONException e) {
            LOG.d(LOG_TAG, e.getLocalizedMessage());
        }

        sendUpdate(connectionType);
        lastInfo = thisInfo;
    }
}
 
Example 5
Project: siiMobilityAppKit   File: NetworkManager.java   View Source Code Vote up 6 votes
/**
 * Updates the JavaScript side whenever the connection changes
 *
 * @param info the current active network info
 * @return
 */
private void updateConnectionInfo(NetworkInfo info) {
    // send update to javascript "navigator.network.connection"
    // Jellybean sends its own info
    JSONObject thisInfo = this.getConnectionInfo(info);
    if(!thisInfo.equals(lastInfo))
    {
        String connectionType = "";
        try {
            connectionType = thisInfo.get("type").toString();
        } catch (JSONException e) {
            LOG.d(LOG_TAG, e.getLocalizedMessage());
        }

        sendUpdate(connectionType);
        lastInfo = thisInfo;
    }
}
 
Example 6
Project: kognitivo   File: Utility.java   View Source Code Vote up 5 votes
public static boolean hasSameId(JSONObject a, JSONObject b) {
    if (a == null || b == null || !a.has("id") || !b.has("id")) {
        return false;
    }
    if (a.equals(b)) {
        return true;
    }
    String idA = a.optString("id");
    String idB = b.optString("id");
    if (idA == null || idB == null) {
        return false;
    }
    return idA.equals(idB);
}
 
Example 7
Project: Interface_Json_Model   File: JsonUtil.java   View Source Code Vote up 5 votes
/**
 * 判断jsonData是否存在key的对象
 * @param key 需要判断的key
 * @return 是否存在
 */
public static boolean hasKey(JSONObject jsonData,String key) {
    if (jsonData==null||!jsonData.has(key) || jsonData.equals("null")) {
        return false;
    } else {
        return true;
    }
}
 
Example 8
Project: OpenVertretung   File: Db.java   View Source Code Vote up 5 votes
public boolean Test()
{
    int id = WriteVertretungsplan("RBSVertretung", "Ulm", "RBS");
    WriteLehrer("Holzer", id);
    WriteArt("Entfall");
    WriteKurs("TGI12/2", "12", "Informatik", id);
    int zugangsArt = WriteZugangsart("Admin");
    WriteZugang("Timo", "4242", zugangsArt);

    JSONObject object = new JSONObject();
    object.put("Lehrer", "Holzer");
    object.put("Fach", "Informatik");
    object.put("Art", "Entfall");
    object.put("Kurs", "TGI12/2");
    object.put("Vertretungsplan", id);
    object.put("StundeVon", 1);
    object.put("StundeBis", 5);
    object.put("Kommentar", "Geil alder");
    object.put("Raum", "B7-1.09");
    object.put("Datum", "01 01 2012");

    JSONArray array = new JSONArray();
    array.put(object);
    String message = WriteZeilen(array);

    JSONObject readObject = new JSONObject();
    readObject.put("Vertretungsplan", id);
    readObject.put("Benutzername", "Timo");
    readObject.put("Passwort", "4242");
    JSONArray read = Read(readObject);
    return object.equals(read);
}