package com.coolape.tianrun; import android.util.Log; import org.json.JSONException; import org.json.JSONObject; public class CallLogInfo { public String number; public String date; public int type; public CallLogInfo(String number, String date, int type) { super(); this.number = number; this.date = date; this.type = type; } public JSONObject toJson(){ try { JSONObject jsonObject = new JSONObject(); jsonObject.put("number", number); jsonObject.put("date", date); /* Call log type for incoming calls. public static final int INCOMING_TYPE = 1; Call log type for outgoing calls. public static final int OUTGOING_TYPE = 2; Call log type for missed calls. public static final int MISSED_TYPE = 3; */ jsonObject.put("type", type); return jsonObject; } catch (JSONException e) { Log.i("", e.getMessage()); return null; } } }