Basically, I need to get JSON data from Git's web API. Great! Did that.
So, now I have a ListView in an android app, each list element is the title and first 140 characters from the json (jsonObject.getString("title"/"body")). When the user clicks on a list element, a dialog with all the comments in supposed to load.
So each issue (JSONObject) should have it's own comments, and indeed I can see the comments in the HTML version of the repo. However, how the heck do I download the comments in JSON form? So far, here's the "comments" element from inside the original issues JSON object:
"comments": 1,
"milestone": null,
"number": 18,
So, doing the stuff in android shouldn't be a big problem. I can detect the user's list item choice, and then get any string inside the JSON object (I figure ID is key in helping to find the comments for that issue). But, I can't figure out how I'm supposed to use GET like it says on this page under HTTP verbs (http://developer.github.com/v3/), I also can't sort out how to utilize the command as seen on this page under Get a Single comment (http://developer.github.com/v3/issues/comments/).
Lastly, I am using a PHP script on a webpage to access the original JSON. So I can envision a situation where I run another PHP script to get the comments JSON based on the list choice the user made (getID) and then work with it on the screen as need. But I can't do that without knowing how to get the comments!
Well, the url to get all the issues is something like this
https://api.github.com/repos/octocat/Hello-World/issues
as you can see you'll receive a list of issues.
After that just select the issue (let's say the number 26 that has 2 comments) and just add to the url "26/comments"
https://api.github.com/repos/octocat/Hello-World/issues/26/comments
and you'll have your comments!
Related
I am trying to create a 'like' feature for my android app using parse as backend.I am currently giving the user the option to like or dislike a post in the details screen. But I want to give the user the option to like a post in the feeds section instead of opening the details screen like tumblr,facebook,twitter and many other apps.I know one way of doing it is running a inner query for every post to check if the post is liked or not.But suppose I am loading 25 posts for the feeds section then I will need to run inner queries for the 25 posts at the same time which will cause performance overhead.So is there any other optimized way for doing.How is the anypic and other parse apps doing this? Please help.
Add a property to your Post class called LikedBy which is an array of pointers to users.
Whenever a user likes the post, add them to the array. Then when you query for the posts, use includeKey on the array and you will know who and how many people have liked it :)
I want to write an app get the information from posts (mostly about new classes) on my university website then make some annoucement once there is new class.
I've google and see RSS mostly, but the page I want to get data does not use RSS. I read something about website using service so we can read XML in the app, but I don't know if the page using service or not. Last resort is using host (somee for example) and js to get text from the page, then the app could read data from the host.
That's all I have right now, but it's still unclear for me. Any suggestion about what to read, what should I use?? Much appreciation
I think the first thing you do should be to ask your uni if they provide any feed or webservice for these data that you could use.
If they don't, or don't answer at all, your last resort would be scraping. To do this, you can use an HTML parser, like jsoup, and then go through the HTML data, getting information as you need.
To see if there are been changes, you would just have to cache your current processed information, probably in a database, and compare the new one to the one currently saved.
I can't seem to find exactly what I'm looking for after a few day's worth of hunting, so if anyone has seen exactly what I'm trying to do elsewhere, I'd love a link or two.
Anyway, I'm trying to build an app to connect into an ERP system that returns user access information in JSON format via REST request using an e-mail address and password. Most users of the system only have a singular access role, so no big deal for them, but others have multiple roles. The trouble I'm having is taking these multiple access roles and adding them into a ListView where they can select the role with which they wish to use to gain access.
Trouble is, I need a display that uses two lines per selection (to properly display all user-pertinent data) and some way to record the user selection. The data useful in the background for the selection would not be displayed, as it would not mean anything to the user. I've been able to take the JSON response and map it to a custom class I designed for it without any problems (not actually all that useful, mostly only helps for discerning the results count prior to displaying multiple results to the ListView). But I can't figure out how to properly build the ListView layout and map the data to the layout. I'm having trouble understanding how to build the view and insert data into new list items.
The best I figure, if I can get the results to display in a ListView and then record the selection in the shared preferences, I'll be golden.
If the listview items being populated from some JSONArray then you could use listview.setOnItemClickListener to get the position of the selected item and match it from the array.Your question seems a little vague. Can you post some code of what you've tried so that it becomes a little clearer?
I am planning to make a desktop application which will have 5 regional newspapers and the user can select either of them to read it.
I need seperate colums such as Opinion,Editorial,Breaking News,Sports,etc. which means I need data of their every column.
But when I visited few papers' websites,they are just giving the headline, one line description and a link to read more as xml feed.On clicking the link the user is directed to their website.
I have seen many android applications like news Hunt ,World news,etc , which show the entire content.How do they do it?Are they using any backdoor or hack or something?
Use Jaunt Api .
The Api has easy-to-learn structure and also the code is efficient as well as fast.
You should give it a try.
Try to use a third service like
http://import.io/ or http://www.mozenda.com
As you said apps like Flipboard, Breaking news sport etc are based on services like import.io
With this you can transform information from the web into usable data easily !
Some of this app used JSON in retrieving the content from the web and pass into android app. check this link
They use an API that allows them to retrieve news (load from a server).
For example yahoo, google, etc
Not tested yet but it works (I'm sure) see yahoo API
In your case, You should write another view to display news details according to the news ID: Read their documentation carefully
Some Websites will write their own public API, which everyone can access with some HTTP header values sent. After sending HTTP request, they return the response in XML / JSON formats which you have to parse them inside your Android app and produce them on UI.
If in case they do not provide any API as such, then you need write a server side Crawler which crawls and parses the information(HTML Tagged information) from their websites and store them. Again then you need to write your own Web services(RESTful / SOAP) that send the parsed information to Android app via URL's or something.
This can be achieved using RSS feed.
visit here and see page source, here you can get all news in item tags like this
<item>
<title>..</title>
<description>...</description>
</item>
where each item tag is for each news, you can fetch both title and description from there.
and you can get data from any link using HTTPPOST or HTTPGET mehods
Is there a way to integrate a mobile database for your app? If so, is it extremely hard? I have not yet started on any code, I just would like to know how it can be done and the measures that encompasses such a desire to integrate a database for the android app.
I would like to do the following:
A user would like to search for a restaurant nearby...they think they know the name of the restaurant, so they begin typing letters. If they type a U, all the restaurants that start with a "U" will show up. Once they find the restaurant they are looking for, they click on it and get the information.
Can this be done?
Thank you.
AFAIK, this is how it works, company who have database need to give you a URL which takes your search term as parameter and returns either XML (or) Json as response. You need to invoke that url by appending your search terms (entered by user) with help HTTPClient API from android, which return corresponding results either XML (or) Json. If Json response you can use android JSonObject api to parse the response. If XML response, you need to use SAX/DOM parsers.