Back to project page ShyHi_Old.
The source code is released under:
GNU General Public License
If you think the Android project ShyHi_Old listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package dev.rug.shyhi.jersey; //from w ww . j av a2s .c o m import org.codehaus.jettison.json.JSONException; import org.codehaus.jettison.json.JSONObject; public class Utitlity { /** * Null check Method * * @param txt * @return */ public static boolean isNotNull(String txt) { // System.out.println("Inside isNotNull"); return txt != null && txt.trim().length() >= 0 ? true : false; } /** * Method to construct JSON * * @param tag * @param status * @return */ public static String constructJSON(String tag, boolean status) { JSONObject obj = new JSONObject(); try { obj.put("tag", tag); obj.put("status", new Boolean(status)); } catch (JSONException e) { // TODO Auto-generated catch block } return obj.toString(); } /** * Method to construct JSON with Error Msg * * @param tag * @param status * @param err_msg * @return */ public static String constructJSON(String tag, boolean status,String err_msg) { JSONObject obj = new JSONObject(); try { obj.put("tag", tag); obj.put("status", new Boolean(status)); obj.put("error_msg", err_msg); } catch (JSONException e) { // TODO Auto-generated catch block } return obj.toString(); } }