Android Open Source - shiftknob-android Json Builder

From Project

Back to project page shiftknob-android.


The source code is released under:

Copyright (c) 2013 Ford Motor Company All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are me...

If you think the Android project shiftknob-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.openxc.shiftindicator;
/* w w  w  . jav  a2s  .c  o m*/
import org.json.JSONException;
import org.json.JSONObject;

import android.util.Log;

public class JsonBuilder {
    private static final String TAG = "JsonBuilder";
    private static final String NAME_FIELD = "name";
    private static final String VALUE_FIELD = "value";

    public static String builder(String name, int value) {
        JSONObject message = new JSONObject();
        try {
            message.put(VALUE_FIELD, value);
            message.put(NAME_FIELD, name);
        } catch (JSONException e) {
            // TODO Auto-generated catch block
            Log.d(TAG, "Unable to create JSONObject");
        return message.toString();

Java Source Code List