I am doing a freelance android project which requires telephone no. operator name from a website. My application will send the telephone no to the website. This is fine, I can do it by requesting a customized URL from the app. But in return how I can get the operator name 开发者_开发百科in my application?
When I enter phone no. in the website it shows a webpage with the operator name.
Here is the phone no. website address:
Thanks for your help.
You need to extract it from the input stream returned by URL.getContent();
For a single information like this regexp pattern matching is best, otherwise you should use a library that handles html parsing such as tagsoup (part of android distro) or my favorite : apache jericho. (Although it can be tough to compile it for android)
You have to parse the response you get via URL.getContent(). In the best case, you can use a standard response format like XML or JSON. In the worsed case you have to parse HTML (which you don't want to, believe me).
精彩评论