[Q] Android studio xml pull parser - Java for Android App Development

I have been trying to find out how to parse TechCrucchs rss feed and use the information in my android app.
The problem is that I the information I find is either outdated, incorrect or just incomprehensible. So how do I get and use the information from this feed?

Pauly69 said:
I have been trying to find out how to parse TechCrucchs rss feed and use the information in my android app.
The problem is that I the information I find is either outdated, incorrect or just incomprehensible. So how do I get and use the information from this feed?
Click to expand...
Click to collapse
I played around with an RSS reader app, and I used this tutorial http://jmsliu.com/1390/rss-reader-app-android-tutorial-1-listview-and-arrayadapter.html which worked for me.

Check HTTP request code (urls and parameters). Maybe, you request wrong data (e.g. wrong date, period or some other param).

Related

How do you get the full article downloaded with Newsbreak or SPB News??

Hi all, I know you can get some rss feeders that purport to download the entire article so you can read it all even offline, but I have not as yet found out how to get either Newsbreak (which I am not sure if it does) or SPB News (which does but I cant figure it out) to do this... can anyone please help me with easy to follow instructions so I can get the full article to read off line etc... thanks in advance...
Spb News can, sort of...
I am using Spb News on my HD2. It is not (and by far) the best RSS reader out there but for a selected number of feeds, there are indeed "templates" which will fetch you the full articles instead of what would otherwise just look like a worthless bunch of tweets. Here is a short extract of the developer's documentation:
Templates in Spb Insight project are intended to download and parse web documents of different kind, mostly news sites. Since different web sites have very different page formatting, a template needs to be created for every site. A template contains information about the site and code to help parse content, clean it up from menus, advertisements and so on.
The template language was created with easiness, popularity and conformity to internet standards in mind. Wide-spread internet language Jscript (a.k.a. ECMAScript) was chosen as the basic language, wrapped with XML to enable metadata processing, such as channel names etc.
One template can contain definitions for multiple channels, as there are usually several channels on one site that has the same formatting and the parsing code for them should be shared.​
Despite the recent release of the renamed v2.0 (from Insight to News) bringing next to nothing new, Spb has seemingly moved their resources away from this product so that the "channels" are no longer kept up-to-date. It is now essentially a matter of trial&error to find out those feeds from the online catalogue that still can return you the full articles, or, you program yourself a template. A third option is to use one of the user-contributed templates directly from the forum.
Good luck and happy news reading!
Z.
Thanks for the info, I was hoping there would be an easy (ier) solution as I am not that savvy with technamolology...
I will have a look and see if I cant figure it all out... cheers.

pulling certain parts of web page from http response

I wanna write a vBulletin viewer for android since we're lacking one atm, but I'm having trouble figuring out how I would pull the information I need to display from the web page i.e. the thread titles, post content etc. I've looked at the vBulletin docs but I haven't found much, and I'm sure android must have an html parser that I'm not finding. Does anyone know how I might go about this?
download the page then parse the file...
Yea, that's a really obvious solution that never occurred to me. Thanks :-D
But since the HTML is being generated, how would I access it from inside the program?
v1nsai said:
But since the HTML is being generated, how would I access it from inside the program?
Click to expand...
Click to collapse
Err... what? How do you want to download it and still don't have access to it?
Brut.all said:
Err... what? How do you want to download it and still don't have access to it?
Click to expand...
Click to collapse
lol right.
You would have to download the whole page to ur program dir(or some temp dir). then open up the file and search out the the information u want. DL'ing the whole page could be time consuming tho, but its the only real way if the website doesnt offer the information in an api.
I think I'm gonna try the rss feeds, seems like most vbulletin forums have rss feeds for each subforum

What Topic Do I Need To Tackle To Develop This Kind Of App?

The harvard university android app from google play store. (I can't seem to post any outside link yet for this account)
I want to create one for may school but I'm just starting to learn android programming, so guys I need your help on the topics that I need to study to create an app like that. I greatly appreciate any kind of comments. Cheers!
clonedaccnt said:
The harvard university android app from google play store. (I can't seem to post any outside link yet for this account)
I want to create one for may school but I'm just starting to learn android programming, so guys I need your help on the topics that I need to study to create an app like that. I greatly appreciate any kind of comments. Cheers!
Click to expand...
Click to collapse
Fragments, ListViews, JSON parsing (for communication with the web server to download news etc), Android SQLite databases (I suggest using this to store the information from the webserver locally so the app does not require a constant internet connection to view a news article for example), Google Cloud Messaging notifications, notifications, encryption.
There are lots more but these are some of the main ones. In addition I would not advise trying to copy the "look" or aesthetics of the Harvard application as it frankly looks disgusting, whoever designed that needs a course in UI design
any book suggestions?? im only studying at home and wanted to start studying android app development
m0nm0npalam0n said:
any book suggestions?? im only studying at home and wanted to start studying android app development
Click to expand...
Click to collapse
Android Application Development for Dummies and Learn Java for Android Development are 2 that I have in ebook form, though I can't say I've used them much as I don't really learn by reading books, more like looking at the source code of other apps and messing with it to see what happens
Android Application Development for Dummies goes through a wide range of topics including widgets, SQLite storage, possibly SharedPreferences (can't remember), ListView etc but does assume that you can at least follow what the sample code is doing - the sample code is commented but if you have not done any coding at all before then you probably should learn the basics of Java before reading it
Jonny said:
Android Application Development for Dummies and Learn Java for Android Development are 2 that I have in ebook form, though I can't say I've used them much as I don't really learn by reading books, more like looking at the source code of other apps and messing with it to see what happens
Android Application Development for Dummies goes through a wide range of topics including widgets, SQLite storage, possibly SharedPreferences (can't remember), ListView etc but does assume that you can at least follow what the sample code is doing - the sample code is commented but if you have not done any coding at all before then you probably should learn the basics of Java before reading it
Click to expand...
Click to collapse
thanks man! this really helps
Jonny said:
Fragments, ListViews, JSON parsing (for communication with the web server to download news etc), Android SQLite databases (I suggest using this to store the information from the webserver locally so the app does not require a constant internet connection to view a news article for example), Google Cloud Messaging notifications, notifications, encryption.
There are lots more but these are some of the main ones. In addition I would not advise trying to copy the "look" or aesthetics of the Harvard application as it frankly looks disgusting, whoever designed that needs a course in UI design
Click to expand...
Click to collapse
Thank you very much for the reply, I'm really thankful for the information that you share. Can you please clear this one for me?
I suggest using this to store the information from the webserver locally so the app does not require a constant internet connection to view a news article for example
Click to expand...
Click to collapse
clonedaccnt said:
Thank you very much for the reply, I'm really thankful for the information that you share. Can you please clear this one for me?
Click to expand...
Click to collapse
When you get data from a server to an Android app you use php for the server code - for example you can use php/mysql to run a search for calendar events in the database and return those events. Then you need to use php's JSON encode function to send the data in a JSON array.
The output should look something like this - this is the output of the calendar database for my school:
http://wgsb.cobainschofield.com/android_db/get_calendar.php (note this is not the live schools site, its the test server the guy who maintains the live site allows me to mess with err use).
You would then use a JSON parser class and an AsyncTask from within the app to "download" the content of the JSON array and then display it in a listview or textview etc.
Now obviously to get this information requires an internet connection yes? So every time someone wanted to check for an event on the calendar or read a news article for example they would need a working internet connection to receive the output of the get_calendar script, this is inefficient and bad design as it does not allow for offline viewing of the data.
Therefore what you can do is use androids SQLite implementation to create a local sql database then the first time you need to get the data from the webserver, you connect to the internet and get the output of the php script, the using the JSON parser class you store the information in the sqlite database then get the information from the database to display to the user.
By this way users can view news articles or calendar events offline and you only need to connect to the internet to refresh the information
I've uploaded screenshots in the attachments of how I've done it for my school's app.
That made it clear! Thank you very much.

java http to pull website data

hello guys
i am having trouble understanding how such apps work and what i need to start developing one
i've learned that you can pull website information using it's API in JSON format and display it
but if the website does not provide an API is possible to get the JSON data of any website? is it done through http request ?
i was also trying to connect my application to several news websites that keeps posting news update is it possible to read the information each time it is updated ?
and what should i know besides java to be able to connect my app to any website get information from this website and display the result regarding if it has an API or not
example : connect to a news website pull the newly posted news and display it or connect to a gaming website get the top 10 games and display them
thank you for your help
ghattas.akkad said:
hello guys
i am having trouble understanding how such apps work and what i need to start developing one
i've learned that you can pull website information using it's API in JSON format and display it
but if the website does not provide an API is possible to get the JSON data of any website? is it done through http request ?
i was also trying to connect my application to several news websites that keeps posting news update is it possible to read the information each time it is updated ?
and what should i know besides java to be able to connect my app to any website get information from this website and display the result regarding if it has an API or not
example : connect to a news website pull the newly posted news and display it or connect to a gaming website get the top 10 games and display them
thank you for your help
Click to expand...
Click to collapse
If the site you're scraping doesn't provide JSON then you can query the site using HTTP. Something like this.
Code:
URL url = new URL(target);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
InputStream in = new BufferedInputStream(connection.getInputStream());
laidlow said:
If the site you're scraping doesn't provide JSON then you can query the site using HTTP. Something like this.
Code:
URL url = new URL(target);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
InputStream in = new BufferedInputStream(connection.getInputStream());
Click to expand...
Click to collapse
thank youu
html parsing is very annoying especially when dealing with a lot of websites in a single app
i was looking for an easier method in which i can access the websites databases pull data and post it but i think if they dont have an API for that they wont give me that permission
ghattas.akkad said:
thank youu
html parsing is very annoying especially when dealing with a lot of websites in a single app
i was looking for an easier method in which i can access the websites databases pull data and post it but i think if they dont have an API for that they wont give me that permission
Click to expand...
Click to collapse
If you want an awesome library that helps you using http requests, take a look at Volley, which is really easy to use on all API levels. I didn't raed through it, but to me it sounds like you want to have some kind of RSS reader functionaly, take a look at this tutorial for instance.

How do I find what libraries an app is using?

Hi folks,
Newbie here, and I expect some bashing as I don't know the rules, but I did saw similar questions so started a thread here.
So, I have decompiled an apk file, and I can see that there are folders in 'src', and after googling a bit I can find some libraries like rebound in the 'com' folder of the decompiled apk. But I couldn't find other libraries as someone suggested me on twitter that devs at times obfuscate things( not sure of the obfuscation!).
I am a business guy, I know less in-depth tech stuff and I am trying to do this for a market research initiative. Is there any easy way to find libraries? For example, I learned about XML and read the structure and got information on one more library present in that APK. Is there a way as easy as this one?
Or incase, if there's a more difficult way, I am ready to learn that no matter what level of difficulty it brings. Hit me up folks!
NOTE: I'm not trying to steal any one's work. This is just a market research work.
You should analyze source code and look for relevant JARs.
Also you can use a software like Charles (charlesproxy com). It analyses all the HTTP traffic on your network, so you can run the app and then monitor the HTTP packets on Charles to detect all possible GET-requests to APIs.
hulak_aleksandr said:
You should analyze source code and look for relevant JARs.
Also you can use a software like Charles (charlesproxy com). It analyses all the HTTP traffic on your network, so you can run the app and then monitor the HTTP packets on Charles to detect all possible GET-requests to APIs.
Click to expand...
Click to collapse
Thanks for the information. I will try doing that. But will also give me information on obfuscated libraries?
What kind of library did you mention? If you looking for native libraries, you can Use an app developed by Savier, named Native Libs Monitor. Search it on Play store.
Check out http://appbrain.com, they got quite nice analytics on apps, including libraries any given app using (under Basic Information -> libraries tab)

Resources