[英]Error for json Service String cannot be converted to JSONObject
if (json.getString(itfdata) != null ) {
String itfdata = json.getString("itfdata");
Log.d("Json Response itfdata is--->","" + itfdata.toString());
}
try {
JSONArray array = new JSONArray(itfdata.toString());
//JSONArray array = new JSONArray(itfdata.toString());
for (int i = 0; i < array.length(); i++) {
list.add(array.getString(i));
System.out.println("I Position : " + array.getString(i));
}
} catch (JSONException e) {
e.printStackTrace();
}
確保您的地址包含https
否則您將得到302 Found
,告訴您重定向到https endpoing。
您的網址應為:
https://www.fitindya.in/windex.php?itfpage=cat_post&id=5
並不是
http://www.fitindya.in/windex.php?itfpage=cat_post&id=5
例如,您可以做的是
String strUrl = getUrlData.replace("http://","https://")+"windex.php?itfpage=cat_post&id="+id;
您還需要在鏈接上添加“ www”。
if(!strUrl.contains("https://www."))
strUrl.replace("https://","https://www.");
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.