problem with JSON - android

I am developing an app which requires JSON. I use the link https://maps.googleapis.com/maps/api/place/autocomplete/json?input=+place+&types=geocode&sensor=true&key=AIzaSyCA4LKD6QfiCrGhZjCsYiRyEGqxKOUEQBU, where place is variable where the predictions are updated for. The problem is it does not take space but works fine in the browser and not in my app. Please give me the format of how variable place should be written or how browser modifies the space given

Replace all spaces with "%20" and than make an API call.
something like
place.replaceAll(" ","%20");
Happy Coding!
Krio

Related

URL encoder not working

I came across a weird situation. I am trying to a develop a android app which send the user entered data to the web server. I used HttpURLConnection and wrote code. It worked a few days. Now when I try to use that app it doesn't send the data if it contains spaces in between. Also if Genymotion emulator is used then it works fine even though spaces are given. I am not getting an idea of what the problem is. What should i do now??
you simply can't write a space directly in an url.
You have to encode it via %20 ... look here In a URL, should spaces be encoded using %20 or +?

Getting wikipedia content page passing its title in Android

I'm developing an Android app that might use Wikipedia API to retrieve the content of a given page (from its title). I searched a lot in the web but I don't find useful information about the implementation. I read the MediaWiki documentation and I tried to format my requests in json format (example: request for "mountain" page content but the text isn't clear and I don't know how manage the request from my Android application.
So, my question is: how can I getting (clear) wikipedia page content by passing the title page from my application? And how to save the well format content in a String (that will corresponds with a TextView in a second moment)?
Anyone knows a good tutorial or can help me with some snippets?
Thank you very much indeed guys! :)
action=parse or action=mobileview or action=query&prop=extracts, depending on what exactly do you need. Use the API sandbox to interactively experiment with various requests, it has usage examples and shows how to build requests properly.

How to notice if there is a change in the html code in your page at the android webview?

I a'm writing a timetable app for my school. Therefore I would have to send a notification if the timetable has been changed. So this would be a change in the html code. I can't use the if modified since option because this webpage is automatically updated, so I have to notice a change in the html code.
I hope someone can help me out of here.
There's two ways to do this well, and neither involves looking at the HTML.
1)Write a webservice to query for the raw information. This can include a timestamp of the last update which you can just compare
2)Do the entire feature via push messaging rather than pull.
The only reasons to even consider checking the HTML for this is if you're doing this without the school's help and screen scraping the information. In which case you may as well just do a string.equals between the last html you got and the current one, there's no better way in that case.

Google Transit Api

i want to fetch Bus time and number etc using This in json or XML format in android , i am able to fetch mode=driving,mode=walking,mode=bicycling etc information , see this link for reference but i want mode=transit , you can check this Link here in Left corner you can see Bus Number, Bus arrival minutes, etc , i want these all details in XML or JSON format , can you suggest me the link or how can i do this ?
Thank you.
i got answer from https://stackoverflow.com/users/1171619/mike
1)There's no official Google Transit API at the momemnt. Transits are provided by agencies, and most of Transits are not public. So, Google is not allowed to open them as API.
2)u may try to consume the "unofficial" data using your link + "&output=json".
3)wever, the result won't be a valid JSON. Instead, that's something, that can be easily converted to a JavaScript object. (The differences are: there is no quotes around property names, the strings are not properly encoded etc.)
4)Imagine you got this JavaScript object. However, it won't allow you to easily get the structured route details. Object's properties contain the route points coordinates, but no descriptions. The only place where the descriptions may be found is 'panel' property, which contains a chunk of HTML text (you may find a link to the sample of HTML in my blog post)
5)So, you'll have to convert this HTML into XML (X-HTML) and then build the parser of this XML to get the essence data of a trip.
6)Seems like a bit of overkill to me. Having in mind, that "unofficial" API may change in the future, including slight changes in 'panel' HTML structure that will kill your parser.
Posted By Mike
Thanks Buddy

Extracting piece of data from youtube data API

I need to extract little piece of Data from Youtube Data API (with params), but what i have only seen , is that i must parse all data to get it ...
Let's see the example that i need :
URL = http://gdata.youtube.com/feeds/api/videos/2ILsMmZG4VM
http://gdata.youtube.com/feeds/api/videos/2ILsMmZG4VM2007-06-03T12:41:05.000Z2011-08-03T08:29:25.000ZDARKER THAN BLACK OPENING HD:EDIT:
First Darker than Black opening. I uploaded this a long time ago and was NOT aware of the poor translations so please don't be upset and just enjoy the music/animation. If the translations really bother you, then watch a different video. Seriously guys...JuN0http://gdata.youtube.com/feeds/api/users/jun0Film:EDIT:
First Darker than Black opening. I uploaded this a long time ago and was NOT aware of the poor translations so please don't be upset and just enjoy the music/animation. If the translations really bother you, then watch a different video. Seriously guys...darker, then, black
And more deep , i can see the part i need , which is the RTSP link :
...media:content url='rtsp://v7.cache8.c.youtube.com/CiILENy73wIaGQlT4UZmMuyC2BMYESARFEgGUgZ2aWRlb3MM/0/0/0/video.3gp' type='video/3gpp' medium='video' expression='full' duration='101' yt:format='6'/
Then what i need to know if exist params to put in the link to extract directly the URL , to not have to parse all the XML .
Thanks for all , and forgive my bad english.
SOLUTION:
I have found it thx to Sherif (1 point for you)
http://gdata.youtube.com/feeds/api/videos?q="2ILsMmZG4VM"&fields=entry(media:group(media:content))
Try this:
http://gdata.youtube.com/feeds/api/videos?q="2ILsMmZG4VM"&fields=entry(media:content)
However The fields parameter is currently used for experimental features only

Categories

Resources