开发者

need tutorials on Android Web Services [closed]

Closed. This question is off-topic. It is not currently accepting answers.
开发者_开发百科

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 11 years ago.

Improve this question

i need some real good Tutorials on using Android Web Services. PLease Help


String str="Webservice Url"
            URL url=new URL(str);
            URLConnection urlc=url.openConnection();
            BufferedReader bfr=new BufferedReader(new           InputStreamReader(urlc.getInputStream()));
            String line;
            while((line=bfr.readLine())!=null)
            {
            JSONArray jsa=new JSONArray(line);
            for(int i=0;i<jsa.length();i++)
                    {
                    JSONObject jo=(JSONObject)jsa.get(i);
                    dispensary_id.add(jo.getString("dispensary_id"));
                    title.add(jo.getString("dispensary_name"));
                    image.add(jo.getString("review"));
                    distance.add(jo.getString("distance"));
                        if(jo.getString("image").equalsIgnoreCase("noimage.png"))
                        {
                        online_image.add(DispensaryConstant.noImageConstant);
                        }
                        else
                        {
                        online_image.add(jo.getString("image"));
                        }
                      }
                }
                }
            catch(MalformedURLException e)
                {
                e.printStackTrace();
                }
            catch(IOException e)
                    {
                e.printStackTrace();
                    }
            catch(JSONException e1)
                {
                e1.printStackTrace();
                }
            handler.sendEmptyMessage(0);
            }                           

It will code id you have Json data and if you have xml data you have to use other way

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜