Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Now Loading. Please Wait ...                Re:Kayo-System Co.,Ltd.2012   2   15
Re:Kayo-System Co.,Ltd.2012   2   15
Re:Kayo-System Co.,Ltd.2012   2   15
Re:Kayo-System Co.,Ltd.2012   2   15
Re:Kayo-System Co.,Ltd.2012   2   15
Re:Kayo-System Co.,Ltd.2012   2   15
Re:Kayo-System Co.,Ltd.2012   2   15
Re:Kayo-System Co.,Ltd.2012   2   15
Re:Kayo-System Co.,Ltd.2012   2   15
Re:Kayo-System Co.,Ltd.2012   2   15
Re:Kayo-System Co.,Ltd.2012   2   15
Re:Kayo-System Co.,Ltd.2012   2   15
Re:Kayo-System Co.,Ltd.2012   2   15
Re:Kayo-System Co.,Ltd.2012   2   15
Re:Kayo-System Co.,Ltd.2012   2   15
Re:Kayo-System Co.,Ltd.2012   2   15
Re:Kayo-System Co.,Ltd.2012   2   15
Re:Kayo-System Co.,Ltd.2012   2   15
Re:Kayo-System Co.,Ltd.2012   2   15
Re:Kayo-System Co.,Ltd.2012   2   15
• Ecrair/Froyo                       Apache HTTP Client           • Gingerbread        HttpURLConnection            API   ...
Re:Kayo-System Co.,Ltd.2012   2   15
Re:Kayo-System Co.,Ltd.2012   2   15
Re:Kayo-System Co.,Ltd.2012   2   15
Re:Kayo-System Co.,Ltd.2012   2   15
oogle Maps API                                 Re:Kayo-System Co.,Ltd.2012   2   15
Re:Kayo-System Co.,Ltd.2012   2   15
Re:Kayo-System Co.,Ltd.2012   2   15
Re:Kayo-System Co.,Ltd.2012   2   15
Re:Kayo-System Co.,Ltd.2012   2   15
Re:Kayo-System Co.,Ltd.2012   2   15
Re:Kayo-System Co.,Ltd.2012   2   15
Re:Kayo-System Co.,Ltd.2012   2   15
Re:Kayo-System Co.,Ltd.2012   2   15
package jp.co.kayo.android.localplayer.ds.ampache.test;  import   java.io.BufferedReader;  import   java.io.IOException;  ...
Re:Kayo-System Co.,Ltd.2012   2   15
try {           URI uri = new URI("http://maps.google.com/maps/api/geocode/json?address=".concat(                   URLEnc...
StringBuilder json = new StringBuilder();       String line;       while ((line = reader.readLine()) != null) {           ...
{       "long_name" : "           ",       "short_name" : "           ",       "types" : [ "locality", "political" ]      ...
private void printAddress(String str){           try {               JSONObject json = new JSONObject(str);               ...
Re:Kayo-System Co.,Ltd.2012   2   15
Upcoming SlideShare
Loading in …5
×

AndroidからWebサービスを使う

6,896 views

Published on

Published in: Technology, Education
  • Dating direct: ♥♥♥ http://bit.ly/2Qu6Caa ♥♥♥
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Sex in your area is here: ♥♥♥ http://bit.ly/2Qu6Caa ♥♥♥
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

AndroidからWebサービスを使う

  1. 1. Now Loading. Please Wait ... Re:Kayo-System Co.,Ltd.2012 2 15
  2. 2. Re:Kayo-System Co.,Ltd.2012 2 15
  3. 3. Re:Kayo-System Co.,Ltd.2012 2 15
  4. 4. Re:Kayo-System Co.,Ltd.2012 2 15
  5. 5. Re:Kayo-System Co.,Ltd.2012 2 15
  6. 6. Re:Kayo-System Co.,Ltd.2012 2 15
  7. 7. Re:Kayo-System Co.,Ltd.2012 2 15
  8. 8. Re:Kayo-System Co.,Ltd.2012 2 15
  9. 9. Re:Kayo-System Co.,Ltd.2012 2 15
  10. 10. Re:Kayo-System Co.,Ltd.2012 2 15
  11. 11. Re:Kayo-System Co.,Ltd.2012 2 15
  12. 12. Re:Kayo-System Co.,Ltd.2012 2 15
  13. 13. Re:Kayo-System Co.,Ltd.2012 2 15
  14. 14. Re:Kayo-System Co.,Ltd.2012 2 15
  15. 15. Re:Kayo-System Co.,Ltd.2012 2 15
  16. 16. Re:Kayo-System Co.,Ltd.2012 2 15
  17. 17. Re:Kayo-System Co.,Ltd.2012 2 15
  18. 18. Re:Kayo-System Co.,Ltd.2012 2 15
  19. 19. Re:Kayo-System Co.,Ltd.2012 2 15
  20. 20. Re:Kayo-System Co.,Ltd.2012 2 15
  21. 21. • Ecrair/Froyo Apache HTTP Client • Gingerbread HttpURLConnection API Android • HttpURLConnection Re:Kayo-System Co.,Ltd.2012 2 15
  22. 22. Re:Kayo-System Co.,Ltd.2012 2 15
  23. 23. Re:Kayo-System Co.,Ltd.2012 2 15
  24. 24. Re:Kayo-System Co.,Ltd.2012 2 15
  25. 25. Re:Kayo-System Co.,Ltd.2012 2 15
  26. 26. oogle Maps API Re:Kayo-System Co.,Ltd.2012 2 15
  27. 27. Re:Kayo-System Co.,Ltd.2012 2 15
  28. 28. Re:Kayo-System Co.,Ltd.2012 2 15
  29. 29. Re:Kayo-System Co.,Ltd.2012 2 15
  30. 30. Re:Kayo-System Co.,Ltd.2012 2 15
  31. 31. Re:Kayo-System Co.,Ltd.2012 2 15
  32. 32. Re:Kayo-System Co.,Ltd.2012 2 15
  33. 33. Re:Kayo-System Co.,Ltd.2012 2 15
  34. 34. Re:Kayo-System Co.,Ltd.2012 2 15
  35. 35. package jp.co.kayo.android.localplayer.ds.ampache.test; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; import java.net.URLEncoder; import android.test.AndroidTestCase; import android.util.Log; public class MapAPITest extends AndroidTestCase { final String TAG = "MapAPI Test"; public void testCallService() { try { URI uri = new URI("http://maps.google.com/maps/api/geocode/json?address=".concat( URLEncoder.encode(" ")).concat("&sensor=false")); HttpURLConnection con = (HttpURLConnection) uri.toURL().openConnection(); InputStream is = con.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(is)); String line; while ((line = reader.readLine()) != null) { Log.d("", line); } is.close(); reader.close(); } catch (URISyntaxException e) { Log.d(TAG, "URI Syntax error", e); } catch (MalformedURLException e) { Log.d(TAG, "URL Malformed Error", e); } catch (IOException e) { Log.d(TAG, "IO error", e); } } } Re:Kayo-System Co.,Ltd.2012 2 15
  36. 36. Re:Kayo-System Co.,Ltd.2012 2 15
  37. 37. try { URI uri = new URI("http://maps.google.com/maps/api/geocode/json?address=".concat( URLEncoder.encode(" ")).concat("&sensor=false")); HttpURLConnection con = (HttpURLConnection) uri.toURL().openConnection(); InputStream is = con.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(is)); StringBuilder json = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { Log.d("", line); json.append(line); } is.close(); reader.close(); } catch (URISyntaxException e) { Log.d(TAG, "URI Syntax error", e); } catch (MalformedURLException e) { Log.d(TAG, "URL Malformed Error", e); } catch (IOException e) { Log.d(TAG, "IO error", e); } Re:Kayo-System Co.,Ltd.2012 2 15
  38. 38. StringBuilder json = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { Log.d("", line); json.append(line); } { "results" : [ { "address_components" : [ { "long_name" : " ", "short_name" : " ", "types" : [ "locality", "political" ] }, { "long_name" : " ", "short_name" : " ", "types" : [ "administrative_area_level_1", "political" ] }, Re:Kayo-System Co.,Ltd.2012 2 15
  39. 39. { "long_name" : " ", "short_name" : " ", "types" : [ "locality", "political" ] } "formatted_address" : " , ", "geometry" : { "bounds" : { "northeast" : { "lat" : 31.63195899999999, "lng" : 130.82772330 }, "southwest" : { "lat" : 31.41453820, "lng" : 130.68629260 } }, "location" : { "lat" : 31.49273440, "lng" : 130.70091430 }, Re:Kayo-System Co.,Ltd.2012 2 15
  40. 40. private void printAddress(String str){ try { JSONObject json = new JSONObject(str); JSONArray results = json.getJSONArray("results"); int count = results.length(); for(int i=0; i<count; i++){ JSONObject item = results.getJSONObject(i); String formatted_address = item.getString("formatted_address"); JSONObject geom = item.getJSONObject("geometry"); JSONObject location = geom.getJSONObject("location"); String lat = location.getString("lat"); String lng = location.getString("lng"); Log.d(TAG, "formatted_address"+ formatted_address); Log.d(TAG, "(lat, lng)="+lat+","+lng); } } catch (JSONException e) { Log.d(TAG, "Json Error", e); } } Re:Kayo-System Co.,Ltd.2012 2 15
  41. 41. Re:Kayo-System Co.,Ltd.2012 2 15

×