Yes you can use the REST api's in android apps. I have used the REST apis for google local search. You need to use... HttpClient object. For parsing using JSON. Check below how i have did it.
Example: HttpClient client = new DefaultHttpClient(); String query = "http://ajax.googleapis.com/ajax/services/search/local? hl=en&v=1.0&q=paris hotel&key="+KEY+"&start="; query+=count; try { URL url = new URL(query); URI uri = new URI(url.getProtocol(), url.getHost(), url.getPath(), url.getQuery(), null); HttpGet request = new HttpGet(uri); HttpResponse response = client.execute(request); result=Userrequest(response); }catch (URISyntaxException e){ } catch(Exception ex){ //txtResult.setText("Failed!"); } public String Userrequest(HttpResponse response){ try{ InputStream in = response.getEntity().getContent(); BufferedReader reader = new BufferedReader(new InputStreamReader(in)); StringBuilder str = new StringBuilder(); String line = null; while((line = reader.readLine()) != null){ str.append(line + "\n"); } in.close(); result = str.toString(); updateData(result); }catch(Exception ex){ result = "Error"; } return result; } public void updateData(String result) { try { JSONObject json=new JSONObject(result); JSONArray ja; json = json.getJSONObject("responseData"); ja = json.getJSONArray("results"); int resultCount = ja.length(); //DATA = new String[resultCount]; //ADDR = new String[resultCount]; for (int i = 0; i < resultCount; i++) { JSONObject resultObject = ja.getJSONObject(i); title.add(resultObject.get("titleNoFormatting").toString()); JSONArray addr; addr = resultObject.getJSONArray("addressLines"); int count = addr.length(); //ADDR[i]=""; String addrr=""; for(int j=0;j<count;j++) { addrr+=addr.getString(j); if(j==0) addrr+=','; } address.add(addrr); } setListAdapter(new EfficientAdapter(this)); } catch(Exception e) { } } Thanks, Mani On Sep 8, 4:06 pm, Marc Lester Tan <mail...@gmail.com> wrote: > I am using the library fromhttp://www.json.org/java/index.html. Just > include the source in your app (or package it into a jar if you want) then > check Test.java for examples on how to use it. > > Cheers, > Marc > > Twitter: mharkushttp://www.appcellar.com > > > > On Wed, Sep 8, 2010 at 3:31 PM, cool.manish <mannishga...@gmail.com> wrote: > > Hi All, > > > In my application, I will call webservices which are written using > > REST and returning JSON object rather than XML. > > My Question is it that Is Android support them? Sending an request to > > REST web services and rendering its response is same as HTTP request > > or something different. > > > I haven't much idea about REST and JSON and haven't much time to find > > out it by myself. Thats why i am posting this question. If someone has > > worked earlier please help me. > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to android-developers@googlegroups.com > > To unsubscribe from this group, send email to > > android-developers+unsubscr...@googlegroups.com<android-developers%2Bunsubs > > cr...@googlegroups.com> > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en