android sard路径,的Android微调:检索从JSON数组值和其他

JSON的问题后在旋转一个显示它:

{

"offer_detail":[

{

"movieid":"72",

"date_value":"2014-05-11",

"showtime":[

"10:30 AM",

"2:30 PM",

"6:30 PM",

"9:30 PM"

],

"screen_no":"SCREEN 2",

"id":"186"

}

],

"success":1,

"message":"Successfully found "

}

我试图显示与欣欣相应时间 一个微调的前内 - 10:30 下午2:30 6:30 PM 9:30 PM

但在我的情况下,它显示整个showtime数组,而不是分别显示时间。

而这正是我已经试过:

c = JSONfunctions

.getJSONfromURL("http://192.168.1.104/OnlineTicketBooking/book_now1.php?movieid='72'");

try {

JSONArray jarray = c.getJSONArray("offer_detail");

ArrayList xyz= new ArrayList();

for(int i = 0; i < jarray.length(); i++){

c = jarray.getJSONObject(i);

xyz.add(c.getString("showtime"));

Log.d("get value",c.getString("showtime"));

}

ArrayAdapter dataAdapter1 = new ArrayAdapter(Booking.this, android.R.layout.simple_spinner_item,xyz);

dataAdapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

spin.setAdapter(dataAdapter1);

String cl=spin.getSelectedItem().toString();

String filenameArray[] = cl.split(",");

int size = filenameArray.length;

Log.d("count",""+size);

ArrayList nw = new ArrayList();

for (int j = 0; j < filenameArray.length; j++) {

JSONObject c = jarray.getJSONObject(j);

nw.add(c.getString("showtime"));

Log.d("getvalue",c.getString("showtime"));

}

ArrayAdapter dataAdapter2 = new ArrayAdapter(Booking.this, android.R.layout.simple_spinner_item,nw);

dataAdapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

spin.setAdapter(dataAdapter2);

spin.setOnItemSelectedListener(new OnItemSelectedListener() {

public void onItemSelected(AdapterView> arg0, View arg1,

int arg2, long arg3) {

// TODO Auto-generated method stub

Toast.makeText(getBaseContext(), spin.getSelectedItem().toString(),

Toast.LENGTH_SHORT).show();

String cl=spin.getSelectedItem().toString();

Log.d("classname",cl);

}

public void onNothingSelected(AdapterView> arg0) {

// TODO Auto-generated method stub

}

});

}

谢谢。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值