本文整理匯總了Java中org.json.JSONException.printStackTrace方法的典型用法代碼示例。如果您正苦於以下問題:Java JSONException.printStackTrace方法的具體用法?Java JSONException.printStackTrace怎麽用?Java JSONException.printStackTrace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.json.JSONException
的用法示例。
在下文中一共展示了JSONException.printStackTrace方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getArrayDouble
import org.json.JSONException; //導入方法依賴的package包/類
public static double[] getArrayDouble(JSONObject docObj, String name) {
double[] list = null;
if (docObj.has(name)) {
JSONArray json;
try {
json = docObj.getJSONArray(name);
int lenFeatures = json.length();
list = new double[lenFeatures];
for (int j = 0; j < lenFeatures; j++) {
double f = json.getDouble(j);
list[j] = f;
}
} catch (JSONException e) {
e.printStackTrace();
}
}
return list;
}
示例2: getList
import org.json.JSONException; //導入方法依賴的package包/類
/**
* 將JSONArray直接轉換為List<T>( 外部json數據專用 )
* @param jsArr 需要解析的JSONArray數據
* @param t 需要轉換成的泛型對象
* @param <T> 繼承自ListItem的對象
* @return 解析後的List<T>>數據
*/
public static <T extends ListItem> List<T> getList(JSONArray jsArr, T t) {
if (jsArr == null) {
return null;
}
try {
if (jsArr == null || jsArr.length() == 0) {
return null;
}
List<T> res = new ArrayList<T>();
T nt = t;
for (int i = 0; i < jsArr.length(); i++) {
if (nt == null) {
nt = t.newObject();
}
nt.praseFromJson(new JsonUtil(jsArr.getJSONObject(i)));
res.add(nt);
nt = null;
}
return res;
} catch (JSONException e) {
e.printStackTrace();
Log.e(tag, e.getMessage());
}
return null;
}
示例3: geAttendanceList
import org.json.JSONException; //導入方法依賴的package包/類
/**
* 獲取當月考勤匯總 <一句話功能簡述>
*
* @Description<功能詳細描述>
*
* @param task
* @param handler
* @param requestType
* @param todayDate
* @return
* @LastModifiedDate:2017-5-8
* @author zxm
* @EditHistory:<修改內容><修改人>
*/
public static NetTask geAttendanceList(NetTask task, Handler handler, int requestType, String curMonthDate)
{
JSONObject bodyVaule = new JSONObject();
try
{
bodyVaule.put("date", curMonthDate);
}
catch (JSONException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
JSONObject requestObj =
NetRequestController.getPredefineObj("attendance",
"AttendanceAdapter",
"getAttendanceList",
"general",
bodyVaule);
return NetRequestController.getClockList(task, handler, requestType, requestObj);
}
示例4: onProfileUpdateSuccess
import org.json.JSONException; //導入方法依賴的package包/類
@Override
public void onProfileUpdateSuccess() {
if (getIntent() != null && getIntent().getStringExtra("branch_params") != null) {
try {
//If clicked on branch link and branch payload has auto_accept key set then don't show Invite Screen and accept invite
JSONObject branchParams = new JSONObject(getIntent().getStringExtra("branch_params"));
if (branchParams.getBoolean(Invite.AUTO_ACCEPT_KEY)) {
HyperTrack.startTracking();
SharedPreferenceManager.setTrackingON(this);
acceptInvite(HyperTrack.getUserId(), branchParams.getString(Invite.ACCOUNT_ID_KEY));
} else {
Intent intent = new Intent(Profile.this, Invite.class);
intent.putExtra("branch_params", getIntent().getStringExtra("branch_params"));
startActivity(intent);
}
return;
} catch (JSONException e) {
e.printStackTrace();
}
}
startPlacelineScreen();
}
示例5: handleProvinceResponse
import org.json.JSONException; //導入方法依賴的package包/類
/**
* 解析和處理服務器返回的省級數據
*/
public static boolean handleProvinceResponse(String response){
if(!TextUtils.isEmpty(response)){
try {
JSONArray allProvince = new JSONArray(response);
for (int i = 0; i < allProvince.length(); i++) {
JSONObject object = allProvince.getJSONObject(i);
Province province = new Province();
province.setProvinceName(object.getString("name"));
province.setProvinceCode(object.getInt("id"));
province.save();
}
return true;
} catch (JSONException e) {
e.printStackTrace();
}
}
return false;
}
示例6: build
import org.json.JSONException; //導入方法依賴的package包/類
public void build(String data){
try {
// PHP에서 받아온 JSON 데이터를 JSON오브젝트로 변환
JSONObject jObject = new JSONObject(data);
// results라는 key는 JSON배열로 되어있다.
JSONArray results = jObject.getJSONArray("result");
String countTemp = (String)jObject.get("num_result");
int count = Integer.parseInt(countTemp);
for ( int i = 0; i < count; ++i ) {
JSONObject temp = results.getJSONObject(i);
convert(temp);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
示例7: receivePath
import org.json.JSONException; //導入方法依賴的package包/類
@Override
public void receivePath(String jsonPath) {
try {
if (jsonPath.isEmpty() || jsonPath.equals("[]")) {
checkIfValidPathOrDie();
} else {
PathManager pathManager = new PathManager(new JSONArray(jsonPath));
path = pathManager.getPath();
Log.d("MEXX", "decoded:" + path.toString());
drawPath();
sendAck();
hideLoadingScreen();
}
} catch (JSONException e) {
e.printStackTrace();
}
}
示例8: refreshCurrentData
import org.json.JSONException; //導入方法依賴的package包/類
private void refreshCurrentData(JSONObject object) {
try {
initHeader(object);
this.mPosts = Post.removeDisablePost(Post.parsePosts(object.getJSONArray("posts")
.toString()));
this.mAdapter = new UserTimelineAdapter(this, this.mPosts, this.mUser);
this.mListView.setAdapter(this.mAdapter);
} catch (JSONException e) {
e.printStackTrace();
}
}
示例9: doSplashScreenAction
import org.json.JSONException; //導入方法依賴的package包/類
private void doSplashScreenAction(String action, JSONArray args) {
CordovaPlugin p = appView.pluginManager.getPlugin("org.apache.cordova.splashscreeninternal");
if (p != null) {
args = args == null ? new JSONArray() : args;
try {
p.execute(action, args, null);
} catch (JSONException e) {
e.printStackTrace();
}
}
}
示例10: onRequestPermissionsResult
import org.json.JSONException; //導入方法依賴的package包/類
/**
* Called by the system when the user grants permissions
*
* @param requestCode
* @param permissions
* @param grantResults
*/
@Override
public void onRequestPermissionsResult(int requestCode, String permissions[],
int[] grantResults) {
try
{
cordovaInterface.onRequestPermissionResult(requestCode, permissions, grantResults);
}
catch (JSONException e)
{
LOG.d(TAG, "JSONException: Parameters fed into the method are not valid");
e.printStackTrace();
}
}
示例11: parse
import org.json.JSONException; //導入方法依賴的package包/類
public static Geo parse(String jsonString) {
if (TextUtils.isEmpty(jsonString)) {
return null;
}
Geo geo = null;
try {
JSONObject jsonObject = new JSONObject(jsonString);
geo = parse(jsonObject);
} catch (JSONException e) {
e.printStackTrace();
}
return geo;
}
示例12: parse
import org.json.JSONException; //導入方法依賴的package包/類
public static User parse(String jsonString) {
try {
JSONObject jsonObject = new JSONObject(jsonString);
return User.parse(jsonObject);
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
示例13: getOfficialActiveNodeList
import org.json.JSONException; //導入方法依賴的package包/類
public static NetTask getOfficialActiveNodeList(NetTask task, Handler handler, int requestType,
String messageitemguid, String type)
{
JSONObject requestObj = null;
JSONObject bodyVaule = new JSONObject();
try
{
bodyVaule.put("messageitemguid", messageitemguid);
bodyVaule.put("type", type);
}
catch (JSONException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
requestObj =
NetRequestController.getPredefineObj("official",
"OfficialAdapter",
"getOfficialActiveNodeList",
"general",
bodyVaule);
return NetRequestController.sendStrBaseServlet(task, handler, requestType, requestObj);
}
示例14: getItem
import org.json.JSONException; //導入方法依賴的package包/類
@Override
public Object getItem(int position) {
try {
return projects.getJSONObject(position);
} catch (JSONException e){
e.printStackTrace();
}
return null;
}
示例15: _deserializeMessageJSON
import org.json.JSONException; //導入方法依賴的package包/類
private JSONArray _deserializeMessageJSON(String messageJSON) {
log("decode", messageJSON);
try {
return new JSONArray(messageJSON);
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}