如何在android中显示实时雅虎财务股票数据.... json格式如下

时间:2016-03-23 12:59:02

标签: javascript android jquery html ajax

 finance_charts_json_callback( { "meta" :
 {
  "uri" :"/instrument/1.0/PTC/chartdata;type=quote;range=1d/json/",
  "ticker" : "ptc",
  "Company-Name" : "PTC Inc.",
  "Exchange-Name" : "NMS",
  "unit" : "MIN",
  "timezone" : "EDT",
  "currency" : "USD",
  "gmtoffset" : -14400,
  "previous_close" : 32.2800
 }
 ,
 "Timestamp" : {"min" :1458653400,"max" :1458676800 }
 ,
 "labels" : [1458655200,1458658800,1458662400,1458666000,1458669600,1458673200,1458676800 ]
 ,
 "ranges" : {"close" : {"min" :32.1500,"max" :32.6750 },"high" : {"min" :32.1500,"max" :32.6750 },"low" : {"min" :32.1500,"max" :32.6616 },"open" : {"min" :32.1500,"max" :32.6616 },"volume" : {"min" :0,"max" :57300 } }
 ,
 "series" : [
 { "Timestamp" :1458653513,"close" :32.3800,"high" :32.3800,"low" :32.3700,"open" :32.3700,"volume" :3900 } 
, { "Timestamp" :1458653582,"close" :32.5000,"high" :32.5450,"low" :32.5000,"open" :32.5450,"volume" :1800 } 
, { "Timestamp" :1458653656,"close" :32.4900,"high" :32.5300,"low" :32.4900,"open" :32.5300,"volume" :900 } 
, { "Timestamp" :1458653721,"close" :32.5000,"high" :32.5100,"low" :32.4700,"open" :32.4800,"volume" :1000 } 
, { "Timestamp" :1458653761,"close" :32.4650,"high" :32.5100,"low" :32.4500,"open" :32.4500,"volume" :800 } 
, { "Timestamp" :1458653836,"close" :32.4200,"high" :32.4600,"low" :32.4200,"open" :32.4500,"volume" :1300 `enter code here`

1 个答案:

答案 0 :(得分:0)

首先,您需要发出http请求以检索数据。请查看本指南以获取帮助:https://developer.android.com/training/volley/simple.html

然后您需要使用Gson等序列化Json数据。接下来,您应该为要显示的数据创建新布局。之后,创建一个新的适配器来处理数据。您可以在帮助中查看本指南:http://www.vogella.com/tutorials/AndroidListView/article.html