Android:无法使用JSON获取数据

时间:2015-05-11 07:33:53

标签: android json google-sheets google-spreadsheet-api

当我尝试拨打服务电话从谷歌电子表格中提取数据时,JSON给我一个空响应?任何想法为什么?

主要活动

private static final String url = https://docs.google.com/spreadsheets/d/1jEN1mzN9modYCdNKziBjaPZDl2L3lmnX2rVA1GVVPB8/gviz/tq?tq=select+*&usp=drive_web&pli=1#gid=0";

ServiceHandler serviceHandler = new ServiceHandler();
// Making a request to url and getting response
String jsonStr =  serviceHandler.makeServiceCall(url,ServiceHandler.GET,null);
Log.d("Response: ", "> " + jsonStr);

清单权限

<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

记录退出

  

libcore.io.GaiException:getaddrinfo failed:EAI_NODATA(No   与主机名关联的地址)   回复:(5829):&gt;空

1 个答案:

答案 0 :(得分:0)

@Andrew V. ...我认为这可能不是问题...上面的网址正在点击浏览器并且结果来了

Working Snapshot

以下是响应json

{"version":"0.6","reqId":"0","status":"ok","sig":"1945351512","table":{"cols":[{"id":"A","label":"Sr No","type":"number","pattern":"General"},{"id":"B","label":"Customer Id","type":"number","pattern":"General"},{"id":"C","label":"Business Name","type":"string"},{"id":"D","label":"Logo Image Link","type":"string"},{"id":"E","label":"Address","type":"string"},{"id":"F","label":"Phone No","type":"number","pattern":"General"},{"id":"G","label":"Email","type":"string"},{"id":"H","label":"Browser Url","type":"string"},{"id":"I","label":"PhotoShoot Link","type":"string"},{"id":"J","label":"Offers","type":"string"}],"rows":[{"c":[{"v":1.0,"f":"1"},{"v":1.0,"f":"1"},{"v":"Dr. Bipin Deshpande"},{"v":"-"},{"v":"Chaitanya Clinic, Lane No 8, Dahanukar Colony, Kothrud, Pune"},{"v":2.025390409E9,"f":"2025390409"},{"v":"drbipin62@gmail.com"},{"v":"http://www.drbipindeshpande.com/"},{"v":"https://www.google.com/maps/@18.495701,73.811325,3a,75y,331.11h,81.46t/data=!3m5!1e1!3m3!1soIQo9XrXtKEAAAAGOwGu_Q!2e0!3e2?hl=en-GB"},{"v":"Coming soon..."}]}]}}

@Akansha ...尝试记录服务电话并查看网址..我认为您的网址存在问题......